xn-auth 0.2.43__tar.gz → 0.2.45__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {xn_auth-0.2.43/xn_auth.egg-info → xn_auth-0.2.45}/PKG-INFO +1 -1
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/controller.py +3 -1
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/models.py +2 -1
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/types.py +7 -2
- {xn_auth-0.2.43 → xn_auth-0.2.45/xn_auth.egg-info}/PKG-INFO +1 -1
- {xn_auth-0.2.43 → xn_auth-0.2.45}/.env.dist +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/.gitignore +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/.pre-commit-config.yaml +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/README.md +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/makefile +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/pyproject.toml +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/setup.cfg +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/enums.py +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/exceptions.py +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/x_auth/middleware.py +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/xn_auth.egg-info/SOURCES.txt +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/xn_auth.egg-info/dependency_links.txt +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/xn_auth.egg-info/requires.txt +0 -0
- {xn_auth-0.2.43 → xn_auth-0.2.45}/xn_auth.egg-info/top_level.txt +0 -0
|
@@ -41,7 +41,9 @@ class Auth:
|
|
|
41
41
|
res = self.jwt.login(
|
|
42
42
|
identifier=str(db_user.id),
|
|
43
43
|
token_extras={"role": db_user.role, "blocked": db_user.blocked},
|
|
44
|
-
response_body=XyncUser.model_validate(
|
|
44
|
+
response_body=XyncUser.model_validate(
|
|
45
|
+
{**user.model_dump(), "xid": db_user.id, "pub": db_user.pub and b64encode(db_user.pub)}
|
|
46
|
+
),
|
|
45
47
|
)
|
|
46
48
|
res.cookies[0].httponly = False
|
|
47
49
|
return res
|
|
@@ -54,6 +54,7 @@ class User(Model):
|
|
|
54
54
|
blocked: bool = BooleanField(default=False)
|
|
55
55
|
lang: Lang | None = IntEnumField(Lang, default=Lang.ru, null=True)
|
|
56
56
|
role: Role = IntEnumField(Role, default=Role.READER)
|
|
57
|
+
prv = UniqBinaryField(unique=True, null=True) # len=32
|
|
57
58
|
pub = UniqBinaryField(unique=True, null=True) # len=32
|
|
58
59
|
|
|
59
60
|
app: BackwardOneToOneRelation["App"]
|
|
@@ -67,7 +68,7 @@ class User(Model):
|
|
|
67
68
|
"last_name": u.last_name,
|
|
68
69
|
"username_id": un.id,
|
|
69
70
|
"lang": u.language_code and Lang[u.language_code],
|
|
70
|
-
"pic": u
|
|
71
|
+
"pic": hasattr(u, "photo_url") and u.photo_url.replace("https://t.me/i/userpic/320/", "")[:-4],
|
|
71
72
|
}
|
|
72
73
|
)
|
|
73
74
|
if blocked is not None:
|
|
@@ -9,6 +9,10 @@ from x_auth.enums import Role
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Xs(Struct):
|
|
12
|
+
@classmethod
|
|
13
|
+
def dec_hook(cls, *args, **kwargs):
|
|
14
|
+
pass
|
|
15
|
+
|
|
12
16
|
def dump(self, nones: bool = False) -> dict:
|
|
13
17
|
return {k: v for k, v in to_builtins(self).items() if nones or v is not None}
|
|
14
18
|
|
|
@@ -18,7 +22,7 @@ class Xs(Struct):
|
|
|
18
22
|
@classmethod
|
|
19
23
|
def load(cls, obj, **kwargs) -> Self:
|
|
20
24
|
dct = dict(obj)
|
|
21
|
-
return convert({**dct, **kwargs}, cls) # , strict=False
|
|
25
|
+
return convert({**dct, **kwargs}, cls, dec_hook=cls.dec_hook) # , strict=False
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
class AuthUser(Struct):
|
|
@@ -63,4 +67,5 @@ class TgUser(Xs):
|
|
|
63
67
|
|
|
64
68
|
|
|
65
69
|
class XyncUser(WebAppUser):
|
|
66
|
-
|
|
70
|
+
xid: int
|
|
71
|
+
pub: bytes | None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|