fix: allow users to login using their email

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-02-05 02:29:41 -08:00
parent f3360d1249
commit c80a16c254
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 18 additions and 1 deletions

View file

@ -79,6 +79,20 @@ def test_login_logout(client: TestClient, user: User):
assert "AURSID" not in response.cookies
def test_login_email(client: TestClient, user: user):
post_data = {
"user": user.Email,
"passwd": "testPassword",
"next": "/"
}
with client as request:
resp = request.post("/login", data=post_data,
allow_redirects=False)
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
assert "AURSID" in resp.cookies
def mock_getboolean(a, b):
if a == "options" and b == "disable_http_login":
return True