mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-22 23:17:09 +00:00
fix: auth not working bugfix
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from http import HTTPStatus as status
|
||||
|
||||
from django.contrib.auth.hashers import check_password
|
||||
from django.shortcuts import get_object_or_404
|
||||
from ninja import Router
|
||||
from ninja.errors import AuthenticationError
|
||||
@@ -46,9 +47,10 @@ def sign_up(request, data: RegisterSchema):
|
||||
)
|
||||
def sign_in(request, data: LoginSchema):
|
||||
user = User.objects.filter(email=data.email).first()
|
||||
print(check_password(data.password, user.password))
|
||||
if not user:
|
||||
raise AuthenticationError
|
||||
if not user.check_password(data.password):
|
||||
if not check_password(data.password, user.password):
|
||||
raise AuthenticationError
|
||||
|
||||
token = BearerAuth.generate_jwt(user)
|
||||
|
||||
Reference in New Issue
Block a user