From 1810ba99039f0b40f68109f9f6f77c04a6f6e34f Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Wed, 2 Nov 2016 20:32:33 +0100 Subject: [PATCH] Changed authentication check --- .gitignore | 3 ++- cards/0861643457.json | 1 + server.py | 7 ++++++- server.pyc | Bin 3936 -> 4080 bytes 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cards/0861643457.json diff --git a/.gitignore b/.gitignore index c61fb3e..9f349ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.sublime-project *.sublime-workspace -sftp-config.json \ No newline at end of file +sftp-config.json +admin.json \ No newline at end of file diff --git a/cards/0861643457.json b/cards/0861643457.json new file mode 100644 index 0000000..b03ae2f --- /dev/null +++ b/cards/0861643457.json @@ -0,0 +1 @@ +{"name": "Willeh", "secretTools": false, "fridge": false} \ No newline at end of file diff --git a/server.py b/server.py index 31661a6..4072c33 100644 --- a/server.py +++ b/server.py @@ -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"'}) diff --git a/server.pyc b/server.pyc index 7752a691c66973294766be541c975c1c794ed7a6..d7af6a053f1850034e7d87b5cbbde037933e4ab1 100644 GIT binary patch delta 573 zcmYk2&r2Io5XWcU{>l%x(JlUrG+HABDcVD{>LF6}RuFw2w4iJQ8%wO&q}dH9Z1CV8 zP|DDgAb1oHrFiiV=)ch33O#wP(t7gJH?M{EFrS@yGvDvNdEX!16ddEHoB2^0`Q+T- zkp%#@ie(kiD}~npT>&vbfDi~c7VvHWx(37udjb*zj*$m81Az6dgC~#(SlKB;*MtNh zF(EKu_>F*e84}dBsq2lmWv$sL@gG;CjAAutxb<*)FKUL$9iUCmMSjgtS!^maTeVOp zdVo*%o7F(;Wm;8|J>tJc_0Zq1M{&&V%D4VU*@yiOK`5voP7dkdB7{I9_@hl|QVUXW5Jv~O zv44a}5yipD)k$!6)UBYKi|?L`!+qX;@4oLI@5Yt)vL=5SiR}H%tu_W%VvNZ=ws?dE zjsasXuw#k&c{TvX4Lom|PS-g-biIfQLEkm`!AzPG#W{MR*X=lMPl&(?!@l2j z@jO$@omJ64utj-;rG zZWcGxReVz>!N3pY8VY!(4xxkvZ6AslYBp5xRl9*Dyof);%4kP#O7V!UcC9jAB^$LU z#)Thv9g!S`{$Jwu+JUH?_>ODp++&pqRs2j2p*FfqH30JXWc)x2AJYeW%hauNh!xm2 zZNs+3x||@e#Fq{7Op!<7==#0LvuO8Lkx(Mc5h{c=!Y00`O}xugXJuX1_32m&vJ}d{ GbKw^b>Q~nQ