mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-15 23:40:17 +02:00
Ensure login tokens always get attached to the user.
This commit is contained in:
parent
ef24bea562
commit
5060d3f408
@ -71,17 +71,19 @@ have the email address embedded much like the username. Key creation and decodin
|
|||||||
@token_required(new=True, scopes=settings.LOGIN_TOKEN_SCOPES)
|
@token_required(new=True, scopes=settings.LOGIN_TOKEN_SCOPES)
|
||||||
def sso_login(request, token):
|
def sso_login(request, token):
|
||||||
user = authenticate(token=token)
|
user = authenticate(token=token)
|
||||||
if user and user.is_active:
|
if user:
|
||||||
login(request, user)
|
token.user = user
|
||||||
return redirect(request.POST.get('next', request.GET.get('next', 'authentication:dashboard')))
|
token.save()
|
||||||
elif user and not user.email:
|
if user.is_active:
|
||||||
# Store the new user PK in the session to enable us to identify the registering user in Step 2
|
login(request, user)
|
||||||
request.session['registration_uid'] = user.pk
|
return redirect(request.POST.get('next', request.GET.get('next', 'authentication:dashboard')))
|
||||||
# Go to Step 2
|
elif not user.email:
|
||||||
return redirect('registration_register')
|
# Store the new user PK in the session to enable us to identify the registering user in Step 2
|
||||||
else:
|
request.session['registration_uid'] = user.pk
|
||||||
messages.error(request, _('Unable to authenticate as the selected character.'))
|
# Go to Step 2
|
||||||
return redirect(settings.LOGIN_URL)
|
return redirect('registration_register')
|
||||||
|
messages.error(request, _('Unable to authenticate as the selected character.'))
|
||||||
|
return redirect(settings.LOGIN_URL)
|
||||||
|
|
||||||
|
|
||||||
# Step 2
|
# Step 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user