Properly set session value for services_region
Currently, the value stored in the services_region cookie is ignored when logging into horizon. This causes confusion for users that have previously selected one region, to find themselves in a different region after their token expires and are forced to log in again. This change sets the services_region session value to the value present in the cookie, with a fallback to the login region. Closes-bug: #2040455 Change-Id: I051648844bf8dffce792ff553e9949285b1be6d4 Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
590632cf5c
commit
66b5713296
@ -192,6 +192,10 @@ def login(request):
|
||||
region_name = regions.get(login_region)
|
||||
request.session['region_endpoint'] = region
|
||||
request.session['region_name'] = region_name
|
||||
# Check for a services_region cookie. Fall back to the login_region.
|
||||
services_region = request.COOKIES.get('services_region', region_name)
|
||||
if services_region in request.user.available_services_regions:
|
||||
request.session['services_region'] = services_region
|
||||
expiration_time = request.user.time_until_expiration()
|
||||
threshold_days = settings.PASSWORD_EXPIRES_WARNING_THRESHOLD_DAYS
|
||||
if (expiration_time is not None and
|
||||
|
Loading…
Reference in New Issue
Block a user