island: Change order of methods in Authenticate to follow stepdown rule

This commit is contained in:
Mike Salvatore 2021-05-04 12:00:10 -04:00
parent 7684a2dcf8
commit 83f7f04929
1 changed files with 8 additions and 8 deletions

View File

@ -30,14 +30,6 @@ class Authenticate(flask_restful.Resource):
See `AuthService.js` file for the frontend counterpart for this code. See `AuthService.js` file for the frontend counterpart for this code.
""" """
@staticmethod
def _authenticate(username, password):
user = user_store.UserStore.username_table.get(username, None)
if user and bcrypt.checkpw(password.encode("utf-8"), user.secret.encode("utf-8")):
return True
return False
def post(self): def post(self):
""" """
Example request: Example request:
@ -62,6 +54,14 @@ class Authenticate(flask_restful.Resource):
else: else:
return make_response({"error": "Invalid credentials"}, 401) return make_response({"error": "Invalid credentials"}, 401)
@staticmethod
def _authenticate(username, password):
user = user_store.UserStore.username_table.get(username, None)
if user and bcrypt.checkpw(password.encode("utf-8"), user.secret.encode("utf-8")):
return True
return False
# See https://flask-jwt-extended.readthedocs.io/en/stable/custom_decorators/ # See https://flask-jwt-extended.readthedocs.io/en/stable/custom_decorators/
def jwt_required(fn): def jwt_required(fn):