Allow override of user authentication logic for API
This commit is contained in:
parent
8cbabfbb95
commit
31ae68f96e
|
@ -82,13 +82,16 @@ class AuthenticationView(APIView):
|
||||||
if not (username and password):
|
if not (username and password):
|
||||||
return {'error': "Invalid username or password"}
|
return {'error': "Invalid username or password"}
|
||||||
|
|
||||||
user = authenticate_user(Session(), username, password)
|
user = self.authenticate_user(username, password)
|
||||||
if not user:
|
if not user:
|
||||||
return {'error': "Invalid username or password"}
|
return {'error': "Invalid username or password"}
|
||||||
|
|
||||||
login_user(self.request, user)
|
login_user(self.request, user)
|
||||||
return self.user_info(user)
|
return self.user_info(user)
|
||||||
|
|
||||||
|
def authenticate_user(self, username, password):
|
||||||
|
return authenticate_user(Session(), username, password)
|
||||||
|
|
||||||
@api
|
@api
|
||||||
def logout(self):
|
def logout(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue