Delete session on log_out() even if telegram logout fails
This commit is contained in:
@@ -398,12 +398,11 @@ class User(AbstractUser, BaseUser):
|
|||||||
self.tgid = None
|
self.tgid = None
|
||||||
await self.save()
|
await self.save()
|
||||||
ok = await self.client.log_out()
|
ok = await self.client.log_out()
|
||||||
if not ok:
|
self.client.session.delete()
|
||||||
return False
|
|
||||||
self.delete()
|
self.delete()
|
||||||
await self.stop()
|
await self.stop()
|
||||||
self._track_metric(METRIC_LOGGED_IN, False)
|
self._track_metric(METRIC_LOGGED_IN, False)
|
||||||
return True
|
return ok
|
||||||
|
|
||||||
def _search_local(self, query: str, max_results: int = 5, min_similarity: int = 45
|
def _search_local(self, query: str, max_results: int = 5, min_similarity: int = 45
|
||||||
) -> List[SearchResult]:
|
) -> List[SearchResult]:
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ class ProvisioningAPI(AuthAPI):
|
|||||||
Optional[web.Response]]):
|
Optional[web.Response]]):
|
||||||
err = self.check_authorization(request)
|
err = self.check_authorization(request)
|
||||||
if err is not None:
|
if err is not None:
|
||||||
return err
|
return None, None, err
|
||||||
|
|
||||||
data = None
|
data = None
|
||||||
if want_data and (request.method == "POST" or request.method == "PUT"):
|
if want_data and (request.method == "POST" or request.method == "PUT"):
|
||||||
|
|||||||
Reference in New Issue
Block a user