Changed authentication check

master
Davide Bongiovanni 8 years ago
parent 69444a2a6f
commit 1810ba9903

1
.gitignore vendored

@ -1,3 +1,4 @@
*.sublime-project *.sublime-project
*.sublime-workspace *.sublime-workspace
sftp-config.json sftp-config.json
admin.json

@ -0,0 +1 @@
{"name": "Willeh", "secretTools": false, "fridge": false}

@ -5,7 +5,12 @@ import json, time
app = Flask(__name__) app = Flask(__name__)
def check_auth(username, password): def check_auth(username, password):
return username == 'davide' and password == 'pwd' admin_list = []
with open('admin.json', 'r') as admin:
admin_list = json.load(admin)
for user in admin_list:
if username == user['username']:
return password == user['password']
def authenticate(): def authenticate():
return Response('Could not verify access level. Please retry', 401, {'WWW-Authenticate' : 'Basic realm="Login Required"'}) return Response('Could not verify access level. Please retry', 401, {'WWW-Authenticate' : 'Basic realm="Login Required"'})

Binary file not shown.
Loading…
Cancel
Save