Changed authentication check

This commit is contained in:
Davide Bongiovanni
2016-11-02 20:32:33 +01:00
parent 69444a2a6f
commit 1810ba9903
4 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -5,7 +5,12 @@ import json, time
app = Flask(__name__)
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():
return Response('Could not verify access level. Please retry', 401, {'WWW-Authenticate' : 'Basic realm="Login Required"'})