mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
return email in /user_info
This commit is contained in:
parent
cb8fa8cba7
commit
c57189e538
3 changed files with 8 additions and 11 deletions
|
@ -649,8 +649,9 @@ Output: if api key is correct, return a json with user name and whether user is
|
|||
|
||||
```json
|
||||
{
|
||||
"name": "John Wick",
|
||||
"is_premium": false
|
||||
"name": "John Wick",
|
||||
"is_premium": false,
|
||||
"email": "john@wick.com"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
from flask import jsonify, request, g
|
||||
from flask import jsonify, g
|
||||
from flask_cors import cross_origin
|
||||
from sqlalchemy import desc
|
||||
|
||||
from app.api.base import api_bp, verify_api_key
|
||||
from app.config import EMAIL_DOMAIN
|
||||
from app.extensions import db
|
||||
from app.log import LOG
|
||||
from app.models import AliasUsedOn, Alias, User
|
||||
from app.utils import convert_to_id, random_word
|
||||
|
||||
|
||||
@api_bp.route("/user_info")
|
||||
|
@ -19,4 +13,6 @@ def user_info():
|
|||
"""
|
||||
user = g.user
|
||||
|
||||
return jsonify({"name": user.name, "is_premium": user.is_premium()})
|
||||
return jsonify(
|
||||
{"name": user.name, "is_premium": user.is_premium(), "email": user.email}
|
||||
)
|
||||
|
|
|
@ -19,7 +19,7 @@ def test_user_in_trial(flask_client):
|
|||
)
|
||||
|
||||
assert r.status_code == 200
|
||||
assert r.json == {"is_premium": True, "name": "Test User"}
|
||||
assert r.json == {"is_premium": True, "name": "Test User", "email": "a@b.c"}
|
||||
|
||||
|
||||
def test_wrong_api_key(flask_client):
|
||||
|
|
Loading…
Reference in a new issue