Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
facebook
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
mautrix
facebook
Commits
18808d35
Commit
18808d35
authored
4 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Add better error message if user gets logged out
parent
7fa67957
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mautrix_facebook/user.py
+12
-2
12 additions, 2 deletions
mautrix_facebook/user.py
with
12 additions
and
2 deletions
mautrix_facebook/user.py
+
12
−
2
View file @
18808d35
...
...
@@ -28,6 +28,7 @@ from mautrix.util.opt_prometheus import Summary, Gauge, async_time
from
maufbapi
import
AndroidState
,
AndroidMQTT
,
AndroidAPI
from
maufbapi.mqtt
import
Disconnect
,
Connect
,
MQTTNotLoggedIn
,
MQTTNotConnected
from
maufbapi.http
import
InvalidAccessToken
from
maufbapi.types
import
graphql
,
mqtt
as
mqtt_t
from
.config
import
Config
...
...
@@ -249,6 +250,15 @@ class User(DBUser, BaseUser):
async
def
try_refresh
(
self
)
->
None
:
try
:
await
self
.
refresh
()
except
InvalidAccessToken
as
e
:
self
.
log
.
exception
(
"
Invalid auth error while trying to refresh after connection error
"
)
await
self
.
send_bridge_notice
(
"
Got authentication error from Messenger:
\n\n
"
f
"
>
{
e
!s}
\n\n
"
"
If you changed your Facebook password or enabled two-
"
"
factor authentication, this is normal and you just
"
"
need to log in again.
"
,
important
=
True
)
await
self
.
logout
(
remove_fbid
=
False
)
except
Exception
:
self
.
log
.
exception
(
"
Fatal error while trying to refresh after connection error
"
)
await
self
.
send_bridge_notice
(
"
Fatal error while trying to refresh after connection
"
...
...
@@ -292,7 +302,7 @@ class User(DBUser, BaseUser):
self
.
start_listen
()
self
.
_is_refreshing
=
False
async
def
logout
(
self
)
->
bool
:
async
def
logout
(
self
,
remove_fbid
:
bool
=
True
)
->
bool
:
ok
=
True
self
.
stop_listen
()
if
self
.
state
:
...
...
@@ -310,7 +320,7 @@ class User(DBUser, BaseUser):
self
.
client
=
None
self
.
mqtt
=
None
if
self
.
fbid
:
if
self
.
fbid
and
remove_fbid
:
await
UserContact
.
delete_all
(
self
.
fbid
)
await
UserPortal
.
delete_all
(
self
.
fbid
)
del
self
.
by_fbid
[
self
.
fbid
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment