From 31ae68f96e537d435f17788c3b3b9fc90d5a2640 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 26 Nov 2019 15:28:03 -0600 Subject: [PATCH] Allow override of user authentication logic for API --- tailbone/api/auth.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tailbone/api/auth.py b/tailbone/api/auth.py index 07c4464d..bf87be27 100644 --- a/tailbone/api/auth.py +++ b/tailbone/api/auth.py @@ -82,13 +82,16 @@ class AuthenticationView(APIView): if not (username and password): return {'error': "Invalid username or password"} - user = authenticate_user(Session(), username, password) + user = self.authenticate_user(username, password) if not user: return {'error': "Invalid username or password"} login_user(self.request, user) return self.user_info(user) + def authenticate_user(self, username, password): + return authenticate_user(Session(), username, password) + @api def logout(self): """