mirror of
https://gitlab.com/brutaldon/brutaldon.git
synced 2024-12-04 14:46:24 -05:00
Forgetting a logged-in account now works
This commit is contained in:
parent
f11e816426
commit
59f2a9cf1e
@ -207,11 +207,12 @@ def forget_account(request, account_name):
|
|||||||
if not accounts_dict or not account_name in accounts_dict.keys():
|
if not accounts_dict or not account_name in accounts_dict.keys():
|
||||||
return False
|
return False
|
||||||
del accounts_dict[account_name]
|
del accounts_dict[account_name]
|
||||||
if len(accounts) == 0:
|
if len(accounts_dict) == 0:
|
||||||
request.session.flush()
|
request.session.flush()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
key = accounts_dict.keys()[0]
|
set_trace()
|
||||||
|
key = [*accounts_dict][0]
|
||||||
request.session['active_user'] = accounts_dict[key]['user']
|
request.session['active_user'] = accounts_dict[key]['user']
|
||||||
try:
|
try:
|
||||||
account = Account.objects.get(id=accounts_dict[key]['account_id'])
|
account = Account.objects.get(id=accounts_dict[key]['account_id'])
|
||||||
@ -1177,11 +1178,11 @@ def accounts(request, id=None):
|
|||||||
if switch_accounts(request, to_account):
|
if switch_accounts(request, to_account):
|
||||||
return redirect(home)
|
return redirect(home)
|
||||||
else:
|
else:
|
||||||
return redirect(accounts)
|
return redirect("accounts")
|
||||||
elif request.POST.get('forget'):
|
elif request.POST.get('forget'):
|
||||||
account = Account.objects.get(id=id).username
|
account = Account.objects.get(id=id).username
|
||||||
forget_account(request, account)
|
forget_account(request, account)
|
||||||
return redirect(accounts)
|
return 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