mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-27 09:10:08 -05:00
Make sure newly created accounts have preferences attached
This commit is contained in:
parent
6cbb2d10ed
commit
cbb5b544ed
@ -216,6 +216,17 @@ def oauth_callback(request):
|
|||||||
redirect_uri=redirect_uri)
|
redirect_uri=redirect_uri)
|
||||||
request.session['access_token'] = access_token
|
request.session['access_token'] = access_token
|
||||||
user = mastodon.account_verify_credentials()
|
user = mastodon.account_verify_credentials()
|
||||||
|
try:
|
||||||
|
account = Account.objects.get(username=username, client_id=client.id)
|
||||||
|
account.access_token = access_token
|
||||||
|
account.save()
|
||||||
|
except (Account.DoesNotExist, Account.MultipleObjectsReturned):
|
||||||
|
preferences = Preferences(theme = Theme.objects.get(1))
|
||||||
|
account = Account(username=user.acct,
|
||||||
|
access_token = access_token,
|
||||||
|
client = Client.objects.get(api_base_id=request.session['instance']),
|
||||||
|
preferences = preferences)
|
||||||
|
account.save()
|
||||||
request.session['user'] = user
|
request.session['user'] = user
|
||||||
return redirect(home)
|
return redirect(home)
|
||||||
|
|
||||||
@ -259,10 +270,12 @@ def old_login(request):
|
|||||||
try:
|
try:
|
||||||
account = Account.objects.get(username=username, client_id=client.id)
|
account = Account.objects.get(username=username, client_id=client.id)
|
||||||
except (Account.DoesNotExist, Account.MultipleObjectsReturned):
|
except (Account.DoesNotExist, Account.MultipleObjectsReturned):
|
||||||
|
preferences = Preferences(theme = Theme.objects.get(1))
|
||||||
account = Account(
|
account = Account(
|
||||||
username = username,
|
username = username,
|
||||||
access_token = "",
|
access_token = "",
|
||||||
client = client)
|
client = client,
|
||||||
|
preferences = preferences)
|
||||||
try:
|
try:
|
||||||
access_token = mastodon.log_in(username,
|
access_token = mastodon.log_in(username,
|
||||||
password)
|
password)
|
||||||
|
Loading…
Reference in New Issue
Block a user