mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
return user email in /api/auth/login
This commit is contained in:
parent
53e9281204
commit
0002531bc0
3 changed files with 3 additions and 1 deletions
|
@ -695,6 +695,7 @@ Input:
|
|||
|
||||
Output:
|
||||
- name: user name, could be an empty string
|
||||
- email: user email
|
||||
- mfa_enabled: boolean
|
||||
- mfa_key: only useful when user enables MFA. In this case, user needs to enter their OTP token in order to login.
|
||||
- api_key: if MFA is not enabled, the `api key` is returned right away.
|
||||
|
|
|
@ -323,7 +323,7 @@ def auth_google():
|
|||
|
||||
|
||||
def auth_payload(user, device) -> dict:
|
||||
ret = {"name": user.name, "mfa_enabled": user.enable_otp}
|
||||
ret = {"name": user.name, "email": user.email, "mfa_enabled": user.enable_otp}
|
||||
|
||||
# do not give api_key, user can only obtain api_key after OTP verification
|
||||
if user.enable_otp:
|
||||
|
|
|
@ -21,6 +21,7 @@ def test_auth_login_success_mfa_disabled(flask_client):
|
|||
|
||||
assert r.status_code == 200
|
||||
assert r.json["api_key"]
|
||||
assert r.json["email"]
|
||||
assert r.json["mfa_enabled"] == False
|
||||
assert r.json["mfa_key"] is None
|
||||
assert r.json["name"] == "Test User"
|
||||
|
|
Loading…
Reference in a new issue