mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-27 09:10:08 -05:00
Hopefully fix issue with re-login with different method
This commit is contained in:
parent
6ce142e11a
commit
a427273f63
@ -1,4 +1,5 @@
|
||||
from django.http import HttpResponse, Http404, HttpResponseRedirect
|
||||
from django.db import IntegrityError
|
||||
from django.conf import settings as django_settings
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse
|
||||
@ -412,16 +413,19 @@ def old_login(request):
|
||||
request.session['active_username'] = user.username + '@' + request.session['active_instance_hostname']
|
||||
account.username = request.session['active_username']
|
||||
request.session['timezone'] = account.preferences.timezone;
|
||||
account.save()
|
||||
|
||||
accounts_dict = request.session.get('accounts_dict')
|
||||
if not accounts_dict:
|
||||
accounts_dict = {}
|
||||
accounts_dict[account.username] = { 'account_id': account.id, 'user': user }
|
||||
request.session['accounts_dict'] = accounts_dict
|
||||
account.save()
|
||||
|
||||
return redirect(home)
|
||||
|
||||
except IntegrityError:
|
||||
account = Account.objects.get(username=account.username)
|
||||
accounts_dict[account.username]['account_id'] = account.id
|
||||
request.session['accounts_dict'] = accounts_dict
|
||||
except Exception as ex:
|
||||
form.add_error('', ex)
|
||||
return render(request, 'setup/login.html', {'form': form})
|
||||
|
Loading…
Reference in New Issue
Block a user