From 586b015eb78a01d40a13c9acad81c274b5be6380 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 28 Dec 2020 16:23:01 +0200 Subject: [PATCH] Login: also return username and email upon login. --- etebase_fastapi/authentication.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etebase_fastapi/authentication.py b/etebase_fastapi/authentication.py index eb54f68..a211e9b 100644 --- a/etebase_fastapi/authentication.py +++ b/etebase_fastapi/authentication.py @@ -46,12 +46,19 @@ class LoginResponse(BaseModel): class UserOut(BaseModel): + username: str + email: str pubkey: bytes encryptedContent: bytes @classmethod def from_orm(cls: t.Type["UserOut"], obj: User) -> "UserOut": - return cls(pubkey=bytes(obj.userinfo.pubkey), encryptedContent=bytes(obj.userinfo.encryptedContent)) + return cls( + username=obj.username, + email=obj.email, + pubkey=bytes(obj.userinfo.pubkey), + encryptedContent=bytes(obj.userinfo.encryptedContent), + ) class LoginOut(BaseModel):