Commit 57872c18 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

New setting to redirect after successful login

redirect to ASTAKOS_LOGIN_SUCCESS_URL after successful login when no
next parameter is set. Defaults to /im/landing
parent 06c17b02
......@@ -359,3 +359,8 @@ GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
# OAuth2 LinkedIn credentials.
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
# Where to redirect the user after successful login when no next parameter is
# set
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
'/im/landing')
......@@ -48,7 +48,7 @@ from django.utils.translation import ugettext as _
from astakos.im.models import AstakosUser, Invitation
from astakos.im.settings import (
COOKIE_DOMAIN, FORCE_PROFILE_UPDATE)
COOKIE_DOMAIN, FORCE_PROFILE_UPDATE, LOGIN_SUCCESS_URL)
from astakos.im.functions import login
import astakos.im.messages as astakos_messages
......@@ -186,7 +186,7 @@ def prepare_response(request, user, next='', renew=False):
request.session.set_expiry(user.auth_token_expires)
if not next:
next = reverse('astakos.im.views.index')
next = LOGIN_SUCCESS_URL
response['Location'] = next
response.status_code = 302
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment