mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 15:23:52 -05:00
Don't switch accounts if deleting not the active account
This commit is contained in:
parent
0c3d4f8405
commit
250837b2c9
@ -211,13 +211,16 @@ def forget_account(request, account_name):
|
|||||||
if len(accounts_dict) == 0:
|
if len(accounts_dict) == 0:
|
||||||
request.session.flush()
|
request.session.flush()
|
||||||
return redirect("about")
|
return redirect("about")
|
||||||
else:
|
elif account_name == request.session["active_username"]:
|
||||||
key = [*accounts_dict][0]
|
key = [*accounts_dict][0]
|
||||||
if switch_accounts(request, key):
|
if switch_accounts(request, key):
|
||||||
return redirect("accounts")
|
return redirect("accounts")
|
||||||
else:
|
else:
|
||||||
request.session.flush()
|
request.session.flush()
|
||||||
return redirect("about")
|
return redirect("about")
|
||||||
|
else:
|
||||||
|
request.session["accounts_dict"] = accounts_dict
|
||||||
|
return redirect("accounts")
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -1180,7 +1183,6 @@ def accounts(request, id=None):
|
|||||||
elif request.POST.get('forget'):
|
elif request.POST.get('forget'):
|
||||||
account = Account.objects.get(id=id).username
|
account = Account.objects.get(id=id).username
|
||||||
return forget_account(request, account)
|
return forget_account(request, account)
|
||||||
redirect("accounts")
|
|
||||||
else:
|
else:
|
||||||
accounts = [x for x in request.session.get('accounts_dict').values()]
|
accounts = [x for x in request.session.get('accounts_dict').values()]
|
||||||
return render(request, 'accounts/list.html',
|
return render(request, 'accounts/list.html',
|
||||||
|
Loading…
Reference in New Issue
Block a user