mirror of
https://github.com/etesync/server
synced 2024-11-25 18:28:46 +00:00
Signup and logout: make sync.
This commit is contained in:
parent
ca7f2ec73c
commit
59e30ed988
@ -250,10 +250,9 @@ async def login(data: Login, request: Request):
|
||||
|
||||
|
||||
@authentication_router.post("/logout/", status_code=status.HTTP_204_NO_CONTENT, responses=permission_responses)
|
||||
async def logout(request: Request, auth_data: AuthData = Depends(get_auth_data)):
|
||||
await sync_to_async(auth_data.token.delete)()
|
||||
# XXX-TOM
|
||||
await sync_to_async(user_logged_out.send)(sender=auth_data.user.__class__, request=None, user=auth_data.user)
|
||||
def logout(request: Request, auth_data: AuthData = Depends(get_auth_data)):
|
||||
auth_data.token.delete()
|
||||
user_logged_out.send(sender=auth_data.user.__class__, request=None, user=auth_data.user)
|
||||
|
||||
|
||||
@authentication_router.post("/change_password/", status_code=status.HTTP_204_NO_CONTENT, responses=permission_responses)
|
||||
@ -306,9 +305,8 @@ def signup_save(data: SignupIn, request: Request) -> User:
|
||||
|
||||
|
||||
@authentication_router.post("/signup/", response_model=LoginOut, status_code=status.HTTP_201_CREATED)
|
||||
async def signup(data: SignupIn, request: Request):
|
||||
user = await sync_to_async(signup_save)(data, request)
|
||||
# XXX-TOM
|
||||
data = await sync_to_async(LoginOut.from_orm)(user)
|
||||
await sync_to_async(user_signed_up.send)(sender=user.__class__, request=None, user=user)
|
||||
def signup(data: SignupIn, request: Request):
|
||||
user = signup_save(data, request)
|
||||
data = LoginOut.from_orm(user)
|
||||
user_signed_up.send(sender=user.__class__, request=None, user=user)
|
||||
return data
|
||||
|
Loading…
Reference in New Issue
Block a user