island: Change order of methods in Authenticate to follow stepdown rule
This commit is contained in:
parent
7684a2dcf8
commit
83f7f04929
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue