From 64c370a8f446b5ca78c03ed0650e4d952fa0fb86 Mon Sep 17 00:00:00 2001 From: Juha Louhiranta Date: Mon, 5 Aug 2024 11:20:45 +0300 Subject: [PATCH] refactor: use REDIRECT_FIELD_NAME instead of hard coded value Refs: HP-2491 --- users/pipeline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/users/pipeline.py b/users/pipeline.py index b0f42402..4481ca8c 100644 --- a/users/pipeline.py +++ b/users/pipeline.py @@ -2,7 +2,7 @@ import uuid from django.conf import settings -from django.contrib.auth import get_user_model, logout +from django.contrib.auth import REDIRECT_FIELD_NAME, get_user_model, logout from django.shortcuts import render from django.urls import reverse from helusers.utils import uuid_to_username @@ -256,10 +256,10 @@ def check_existing_social_associations(backend, strategy, user=None, social=None ' with a different user. Log out and fail the login.') # Save the existing next value from the session and add it back after log out # so that InterruptedSocialAuthMiddleware can redirect back to the OIDC client - next_url = strategy.session.get('next') + next_url = strategy.session_get(REDIRECT_FIELD_NAME) logout(request) if next_url: - strategy.session_set('next', next_url) + strategy.session_set(REDIRECT_FIELD_NAME, next_url) raise AuthFailed(backend, 'Duplicate login')