Fix utils auth bugs
This commit is contained in:
parent
3bf8743e9a
commit
ca8083859c
|
@ -11,7 +11,7 @@ from rest_auth.serializers import PasswordChangeSerializer, PasswordResetSeriali
|
||||||
from rest_auth.serializers import UserDetailsSerializer
|
from rest_auth.serializers import UserDetailsSerializer
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from . import models, fields, utils, utils_ldap
|
from . import models, fields, utils, utils_ldap, utils_auth
|
||||||
from .. import settings, secrets
|
from .. import settings, secrets
|
||||||
|
|
||||||
class TransactionSerializer(serializers.ModelSerializer):
|
class TransactionSerializer(serializers.ModelSerializer):
|
||||||
|
@ -549,6 +549,9 @@ class HistorySerializer(serializers.ModelSerializer):
|
||||||
class SpaceportAuthSerializer(LoginSerializer):
|
class SpaceportAuthSerializer(LoginSerializer):
|
||||||
def authenticate(self, **kwargs):
|
def authenticate(self, **kwargs):
|
||||||
result = super().authenticate(**kwargs)
|
result = super().authenticate(**kwargs)
|
||||||
print(result)
|
|
||||||
print(self.context['request'].data)
|
if result:
|
||||||
|
data = self.context['request'].data
|
||||||
|
utils_auth.set_password(data)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -23,6 +23,6 @@ def auth_api(route, data):
|
||||||
def set_password(data):
|
def set_password(data):
|
||||||
auth_data = dict(
|
auth_data = dict(
|
||||||
username=data['username'],
|
username=data['username'],
|
||||||
password=data['password1'],
|
password=data['password'],
|
||||||
)
|
)
|
||||||
return auth_api('set-password', auth_data)
|
return auth_api('set-password', auth_data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user