fix 500 when logging in with mastdon with an existing oauth token

This commit is contained in:
codl 2017-08-19 14:32:31 +02:00
parent 126c24db5f
commit 0dbfa5e0bc
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 5 additions and 5 deletions

View File

@ -54,10 +54,11 @@ def receive_code(code, app, callback):
remote_acc = api.account_verify_credentials()
acc = account_from_api_object(remote_acc, app.instance)
acc = db.session.merge(acc)
token = OAuthToken(account = acc, token = access_token)
token = OAuthToken(token = access_token)
token = db.session.merge(token)
token.account = acc
return acc
return token
def get_api_for_acc(account):

View File

@ -241,9 +241,8 @@ def mastodon_login_step2(instance):
callback = url_for('mastodon_login_step2', instance=instance, _external=True)
account = lib.mastodon.receive_code(code, app, callback)
account = db.session.merge(account)
token = lib.mastodon.receive_code(code, app, callback)
account = token.account
sess = Session(account = account)
db.session.add(sess)