Commit 537fc8ca authored by David Foucher's avatar David Foucher

Merge branch '19-ne-pas-tenir-compte-de-la-casse-pour-le-login' into 'master'

Resolve "Ne pas tenir compte de la casse pour le login"

Closes #19

See merge request !52
parents 4b9d6701 a3bf1f36
Pipeline #2969 passed with stage
in 1 minute and 24 seconds
......@@ -538,6 +538,20 @@ async def test_authentification(patch_authorisations, client, mock_get):
}
async def test_authentification_with_different_case_email(patch_authorisations, client, mock_get):
body = {
"email": "test@test.com",
"password": "test",
"file": "/règles nationales/CPF.rules"
}
auth = body.copy()
auth['email'] = 'Test@test.com'
patch_authorisations([auth])
resp = await client.post("/authentification", body=body)
assert resp.status == HTTPStatus.OK
async def test_authentification_with_no_authorisation(patch_authorisations, client, mock_get):
body = {
"email": "test@test.fr",
......
......@@ -193,11 +193,11 @@ async def authent(request, response):
date = datetime.datetime.today().strftime('%y%m%d')
authsuccess = False
for authorized in AUTHORIZED:
aemail = authorized['email']
aemail = authorized['email'].lower()
apassword = authorized['password']
afile = authorized['file']
atoken = hash(f"{aemail}.{apassword}.{date}")
if data.get('email') == aemail and data.get('password') == apassword:
if str(data.get('email')).lower() == aemail and data.get('password') == apassword:
try:
if any(bool(re.match(afile, f)) for f in data.get('file').split("|")):
authsuccess = True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment