xn-auth 0.0.2__tar.gz → 0.0.3.dev1__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.0.2 → xn_auth-0.0.3.dev1}/.pre-commit-config.yaml +1 -1
- {xn_auth-0.0.2/xn_auth.egg-info → xn_auth-0.0.3.dev1}/PKG-INFO +1 -1
- xn_auth-0.0.3.dev1/x_auth/models.py +24 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1/xn_auth.egg-info}/PKG-INFO +1 -1
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/xn_auth.egg-info/SOURCES.txt +1 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/.env.dist +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/.gitignore +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/README.md +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/makefile +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/pyproject.toml +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/setup.cfg +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/x_auth/__init__.py +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/xn_auth.egg-info/dependency_links.txt +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/xn_auth.egg-info/requires.txt +0 -0
- {xn_auth-0.0.2 → xn_auth-0.0.3.dev1}/xn_auth.egg-info/top_level.txt +0 -0
|
@@ -14,7 +14,7 @@ repos:
|
|
|
14
14
|
- id: build
|
|
15
15
|
name: build
|
|
16
16
|
### build & upload package only for "main" branch push
|
|
17
|
-
entry: bash -c 'echo $PRE_COMMIT_LOCAL_BRANCH | grep /
|
|
17
|
+
entry: bash -c 'echo $PRE_COMMIT_LOCAL_BRANCH | grep /main && make build || echo 0'
|
|
18
18
|
language: system
|
|
19
19
|
pass_filenames: false
|
|
20
20
|
verbose: true
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from tortoise.fields import CharField
|
|
2
|
+
from x_model import User as BaseUser
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class User(BaseUser):
|
|
6
|
+
from pwdlib import PasswordHash
|
|
7
|
+
|
|
8
|
+
__cc = PasswordHash.recommended()
|
|
9
|
+
|
|
10
|
+
password: str | None = CharField(60, null=True)
|
|
11
|
+
|
|
12
|
+
def pwd_vrf(self, pwd: str) -> bool:
|
|
13
|
+
return self.__cc.verify(pwd, self.password)
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
async def create(cls, using_db=None, **kwargs) -> BaseUser:
|
|
17
|
+
user: User = await super().create(using_db, **kwargs)
|
|
18
|
+
if pwd := kwargs.get("password"):
|
|
19
|
+
await user.set_pwd(pwd)
|
|
20
|
+
return user
|
|
21
|
+
|
|
22
|
+
async def set_pwd(self, pwd: str = password) -> None:
|
|
23
|
+
self.password = self.__cc.hash(pwd)
|
|
24
|
+
await self.save()
|
|
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
|