mirror of
https://github.com/KevinMidboe/Node-Com-Handler.git
synced 2025-10-29 17:50:27 +00:00
Fixed authentication required
This commit is contained in:
Binary file not shown.
24
v1/app.py
24
v1/app.py
@@ -23,22 +23,22 @@ users = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Flask function for checking password sent with http request
|
# Flask function for checking password sent with http request
|
||||||
@auth.verify_password
|
# @auth.verify_password
|
||||||
def verify_password(email, password):
|
# def verify_password(email, password):
|
||||||
return verifyHash(password)
|
# return verifyHash(password)
|
||||||
|
|
||||||
# Costum function for hashing and verifying the sent password.
|
# # Costum function for hashing and verifying the sent password.
|
||||||
# TODO Read if ok to send in cleartext like this if use https
|
# # TODO Read if ok to send in cleartext like this if use https
|
||||||
def verifyHash(pw):
|
# def verifyHash(pw):
|
||||||
pw_hash = generate_password_hash(pw)
|
# pw_hash = generate_password_hash(pw)
|
||||||
return check_password_hash(pw_hash, pw)
|
# return check_password_hash(pw_hash, pw)
|
||||||
|
|
||||||
# Flask function for getting password matching username sent by http request
|
# Flask function for getting password matching username sent by http request
|
||||||
@auth.get_password
|
@auth.get_password
|
||||||
def get_pw(username):
|
def get_pw(username):
|
||||||
if username in users:
|
if username in users:
|
||||||
return users.get(username)
|
return users.get(username)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Flasks own error handler that makes and returns error 401 if creds
|
# Flasks own error handler that makes and returns error 401 if creds
|
||||||
# to not match.
|
# to not match.
|
||||||
@@ -101,4 +101,4 @@ def get_uptimesLoad():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0',port=63580,debug=True)
|
app.run(host='0.0.0.0', port=63588)
|
||||||
|
|||||||
Reference in New Issue
Block a user