mirror of
https://github.com/simple-login/app.git
synced 2025-02-20 22:02:54 +08:00
use null instead of "" in /api/auth/login
This commit is contained in:
parent
3483faa34a
commit
c7903d534a
2 changed files with 4 additions and 4 deletions
|
@ -54,11 +54,11 @@ def auth_login():
|
|||
if user.enable_otp:
|
||||
s = Signer(FLASK_SECRET)
|
||||
ret["mfa_key"] = s.sign(str(user.id))
|
||||
ret["api_key"] = ""
|
||||
ret["api_key"] = None
|
||||
else:
|
||||
api_key = ApiKey.create(user.id, device)
|
||||
db.session.commit()
|
||||
ret["mfa_key"] = ""
|
||||
ret["mfa_key"] = None
|
||||
ret["api_key"] = api_key.code
|
||||
|
||||
return jsonify(**ret), 200
|
||||
|
|
|
@ -16,7 +16,7 @@ def test_auth_login_success_mfa_disabled(flask_client):
|
|||
assert r.status_code == 200
|
||||
assert r.json["api_key"]
|
||||
assert r.json["mfa_enabled"] == False
|
||||
assert r.json["mfa_key"] == ""
|
||||
assert r.json["mfa_key"] is None
|
||||
assert r.json["name"] == "Test User"
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ def test_auth_login_success_mfa_enabled(flask_client):
|
|||
)
|
||||
|
||||
assert r.status_code == 200
|
||||
assert r.json["api_key"] == ""
|
||||
assert r.json["api_key"] is None
|
||||
assert r.json["mfa_enabled"] == True
|
||||
assert r.json["mfa_key"]
|
||||
assert r.json["name"] == "Test User"
|
||||
|
|
Loading…
Reference in a new issue