xn-auth 0.2.51.dev1__tar.gz → 0.2.52__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.51.dev1/xn_auth.egg-info → xn_auth-0.2.52}/PKG-INFO +1 -1
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/controller.py +4 -2
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/models.py +1 -1
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52/xn_auth.egg-info}/PKG-INFO +1 -1
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/.env.dist +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/.gitignore +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/.pre-commit-config.yaml +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/README.md +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/makefile +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/pyproject.toml +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/setup.cfg +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/enums.py +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/exceptions.py +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/middleware.py +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/x_auth/types.py +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/xn_auth.egg-info/SOURCES.txt +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/xn_auth.egg-info/dependency_links.txt +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/xn_auth.egg-info/requires.txt +0 -0
- {xn_auth-0.2.51.dev1 → xn_auth-0.2.52}/xn_auth.egg-info/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
from base64 import b64encode
|
|
2
3
|
from datetime import timedelta
|
|
3
4
|
|
|
@@ -38,8 +39,7 @@ class Auth:
|
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
async def user_proc(user: WebAppUser) -> Response[XyncUser]:
|
|
41
|
-
|
|
42
|
-
db_user, cr = await user_model.update_or_create(**user_in.df_unq()) # on login: update user in db from tg
|
|
42
|
+
db_user, cr = await user_model.tg_upsert(user) # on login: update user in db from tg
|
|
43
43
|
if user.allows_write_to_pm is None:
|
|
44
44
|
try:
|
|
45
45
|
await Bot(sec).send_chat_action(user.id, "typing")
|
|
@@ -77,7 +77,9 @@ class Auth:
|
|
|
77
77
|
try:
|
|
78
78
|
twaid: WebAppInitData = safe_parse_webapp_init_data(self.jwt.token_secret, tid)
|
|
79
79
|
except ValueError as e:
|
|
80
|
+
logging.error(e)
|
|
80
81
|
raise NotAuthorizedException(detail=f"Tg Initdata invalid {e}")
|
|
82
|
+
logging.warning({tid: twaid})
|
|
81
83
|
return await user_proc(twaid.user)
|
|
82
84
|
|
|
83
85
|
self.tma_handler = tma
|
|
@@ -82,7 +82,7 @@ class User(Model):
|
|
|
82
82
|
return (await cls[int(sid)]).blocked
|
|
83
83
|
|
|
84
84
|
@classmethod
|
|
85
|
-
async def tg_upsert(cls, u: PyroUser | AioUser, blocked: bool = None) -> tuple["User", bool]:
|
|
85
|
+
async def tg_upsert(cls, u: PyroUser | AioUser | WebAppUser, blocked: bool = None) -> tuple["User", bool]:
|
|
86
86
|
user_in: dict = await cls.tg2in(u, blocked)
|
|
87
87
|
return await cls.update_or_create(user_in, username_id=u.id)
|
|
88
88
|
|
|
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
|
|
File without changes
|