Skip to content

Commit 5eef9a7

Browse files
committed
Добавил при отвязке метода входа удаление юзердаты
1 parent 989e7c3 commit 5eef9a7

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

auth_backend/auth_method/outer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from auth_backend.auth_method.base import AuthPluginMeta
1111
from auth_backend.base import Base
12-
from auth_backend.models.db import AuthMethod, UserSession
12+
from auth_backend.models.db import AuthMethod, User, UserSession
1313
from auth_backend.utils.security import UnionAuth
1414

1515

@@ -205,8 +205,7 @@ async def _unlink(
205205
"""
206206
if cls.delete_scope() not in (s.name for s in request_user.scopes):
207207
raise HTTPException(status_code=HTTP_403_FORBIDDEN, detail="Not authorized")
208-
username = await cls.__get_username(user_id)
209-
if not username:
208+
user = User.get(user_id, session=db.session)
209+
if not user:
210210
raise UserNotLinked(user_id)
211-
username.is_deleted = True
212-
db.session.commit()
211+
await cls._delete_auth_methods(user, db_session=db.session)

auth_backend/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from annotated_types import Gt
99
from pydantic import PostgresDsn
10-
from pydantic.types import PathType
1110
from pydantic_settings import BaseSettings, SettingsConfigDict
1211

1312

0 commit comments

Comments
 (0)