Commit d9d760cd authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas
Browse files

astakos: remove BASEURL, use BASE_URL setting

parent 8b4a778c
......@@ -536,13 +536,13 @@ class ExtendedPasswordResetForm(PasswordResetForm):
"""
for user in self.users_cache:
url = user.astakosuser.get_password_reset_url(token_generator)
url = join_urls(settings.BASEURL, url)
url = join_urls(settings.BASE_URL, url)
c = {
'email': user.email,
'url': url,
'site_name': settings.SITENAME,
'user': user,
'baseurl': settings.BASEURL,
'baseurl': settings.BASE_URL,
'support': settings.CONTACT_EMAIL
}
message = render_to_string(email_template_name, c)
......
......@@ -86,7 +86,7 @@ def send_verification(user, template_name='im/activation_email.txt'):
message = render_to_string(template_name, {
'user': user,
'url': url,
'baseurl': settings.BASEURL,
'baseurl': settings.BASE_URL,
'site_name': settings.SITENAME,
'support': settings.CONTACT_EMAIL})
sender = settings.SERVER_EMAIL
......@@ -164,11 +164,11 @@ def send_invitation(invitation, template_name='im/invitation.txt'):
Send invitation email.
"""
subject = _(astakos_messages.INVITATION_EMAIL_SUBJECT)
url = '%s?code=%d' % (join_urls(settings.BASEURL, reverse('index')), invitation.code)
url = '%s?code=%d' % (join_urls(settings.BASE_URL, reverse('index')), invitation.code)
message = render_to_string(template_name, {
'invitation': invitation,
'url': url,
'baseurl': settings.BASEURL,
'baseurl': settings.BASE_URL,
'site_name': settings.SITENAME,
'support': settings.CONTACT_EMAIL})
sender = settings.SERVER_EMAIL
......@@ -190,8 +190,8 @@ def send_greeting(user, email_template_name='im/welcome_email.txt'):
subject = _(astakos_messages.GREETING_EMAIL_SUBJECT)
message = render_to_string(email_template_name, {
'user': user,
'url': join_urls(settings.BASEURL, reverse('index')),
'baseurl': settings.BASEURL,
'url': join_urls(settings.BASE_URL, reverse('index')),
'baseurl': settings.BASE_URL,
'site_name': settings.SITENAME,
'support': settings.CONTACT_EMAIL})
sender = settings.SERVER_EMAIL
......
......@@ -3,6 +3,7 @@ from synnefo_branding import settings as synnefo_settings
from synnefo.lib import parse_base_url
from astakosclient import astakos_services
from synnefo.util.keypath import get_path
from synnefo.lib import join_urls
BASE_URL = getattr(settings, 'ASTAKOS_BASE_URL',
......@@ -58,9 +59,6 @@ IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
# will be automatically accepted
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)
# Set baseurl
BASEURL = getattr(settings, 'ASTAKOS_BASE_URL', 'https://accounts.example.synnefo.org')
# Set service name
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', synnefo_settings.SERVICE_NAME)
......@@ -134,7 +132,7 @@ SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
False)
default_redirect_url = join_urls(ASTAKOS_BASE_URL, VIEWS_PREFIX, "landing")
default_redirect_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
ACTIVATION_REDIRECT_URL = getattr(settings, 'ASTAKOS_ACTIVATION_REDIRECT_URL',
default_redirect_url)
......@@ -160,7 +158,7 @@ LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
# URL to redirect the user after successful login when no next parameter is set
default_success_url = join_urls(ASTAKOS_BASE_URL, VIEWS_PREFIX, "landing")
default_success_url = join_urls(BASE_URL, VIEWS_PREFIX, "landing")
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
default_redirect_url)
......
......@@ -56,7 +56,7 @@ class ShibbolethTests(TestCase):
# eepn required
r = client.get('/im/login/shibboleth?', follow=True)
self.assertContains(r, messages.SHIBBOLETH_MISSING_EPPN % {
'domain': astakos_settings.BASEURL,
'domain': astakos_settings.BASE_URL,
'contact_email': settings.CONTACT_EMAIL
})
client.set_tokens(eppn="kpapeppn")
......
......@@ -76,7 +76,7 @@ request_token_url = django_setting(
def get_redirect_uri():
return "%s%s" % (settings.BASEURL,
return "%s%s" % (settings.BASE_URL,
reverse('astakos.im.views.target.google.authenticated'))
......
......@@ -95,7 +95,7 @@ def login(
if not eppn:
raise KeyError(_(astakos_messages.SHIBBOLETH_MISSING_EPPN) % {
'domain': settings.BASEURL,
'domain': settings.BASE_URL,
'contact_email': settings.CONTACT_EMAIL
})
if Tokens.SHIB_DISPLAYNAME in tokens:
......
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