feat(auth): implement JWT authentication with secure password hashing
This commit is contained in:
parent
6656a8782c
commit
56df3228a4
7 changed files with 146 additions and 74 deletions
|
|
@ -2,6 +2,7 @@ from sqlalchemy.orm import Session
|
|||
|
||||
from app.models.user import User
|
||||
from app.schemas.user import UserCreate
|
||||
from app.core.security import hash_password
|
||||
|
||||
|
||||
class UserRepository:
|
||||
|
|
@ -14,10 +15,10 @@ class UserRepository:
|
|||
def create(db: Session, user: UserCreate):
|
||||
|
||||
db_user = User(
|
||||
username=user.username,
|
||||
email=user.email,
|
||||
password_hash=user.password
|
||||
)
|
||||
username=user.username,
|
||||
email=user.email,
|
||||
password_hash=hash_password(user.password),
|
||||
)
|
||||
|
||||
db.add(db_user)
|
||||
db.commit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue