Fix utils auth bugs

This commit is contained in:
Tanner Collin 2020-09-20 00:24:28 +00:00
parent 3bf8743e9a
commit ca8083859c
2 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,7 @@ from rest_auth.serializers import PasswordChangeSerializer, PasswordResetSeriali
from rest_auth.serializers import UserDetailsSerializer
import re
from . import models, fields, utils, utils_ldap
from . import models, fields, utils, utils_ldap, utils_auth
from .. import settings, secrets
class TransactionSerializer(serializers.ModelSerializer):
@ -549,6 +549,9 @@ class HistorySerializer(serializers.ModelSerializer):
class SpaceportAuthSerializer(LoginSerializer):
def authenticate(self, **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

View File

@ -23,6 +23,6 @@ def auth_api(route, data):
def set_password(data):
auth_data = dict(
username=data['username'],
password=data['password1'],
password=data['password'],
)
return auth_api('set-password', auth_data)