mirror of
https://github.com/codl/forget
synced 2025-01-08 13:42:35 +01:00
fix 500 when logging in with mastdon with an existing oauth token
This commit is contained in:
parent
126c24db5f
commit
0dbfa5e0bc
@ -54,10 +54,11 @@ def receive_code(code, app, callback):
|
|||||||
remote_acc = api.account_verify_credentials()
|
remote_acc = api.account_verify_credentials()
|
||||||
acc = account_from_api_object(remote_acc, app.instance)
|
acc = account_from_api_object(remote_acc, app.instance)
|
||||||
acc = db.session.merge(acc)
|
acc = db.session.merge(acc)
|
||||||
token = OAuthToken(account = acc, token = access_token)
|
token = OAuthToken(token = access_token)
|
||||||
token = db.session.merge(token)
|
token = db.session.merge(token)
|
||||||
|
token.account = acc
|
||||||
|
|
||||||
return acc
|
return token
|
||||||
|
|
||||||
|
|
||||||
def get_api_for_acc(account):
|
def get_api_for_acc(account):
|
||||||
|
@ -241,9 +241,8 @@ def mastodon_login_step2(instance):
|
|||||||
|
|
||||||
callback = url_for('mastodon_login_step2', instance=instance, _external=True)
|
callback = url_for('mastodon_login_step2', instance=instance, _external=True)
|
||||||
|
|
||||||
account = lib.mastodon.receive_code(code, app, callback)
|
token = lib.mastodon.receive_code(code, app, callback)
|
||||||
|
account = token.account
|
||||||
account = db.session.merge(account)
|
|
||||||
|
|
||||||
sess = Session(account = account)
|
sess = Session(account = account)
|
||||||
db.session.add(sess)
|
db.session.add(sess)
|
||||||
|
Loading…
Reference in New Issue
Block a user