Commit 9390bc5f authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Proper missing eppn message

parent 2447ca02
......@@ -94,7 +94,12 @@ EMAIL_USED = 'This email address is already in us
SHIBBOLETH_EMAIL_USED = 'This email is already associated with another shibboleth account.'
SHIBBOLETH_INACTIVE_ACC = 'This email is already associated with an inactive account. \
You need to wait to be activated before being able to switch to a shibboleth account.'
SHIBBOLETH_MISSING_EPPN = 'Missing unique token in request.'
SHIBBOLETH_MISSING_EPPN = 'Your request is missing a unique ' + \
'token. This means your academic ' + \
'institution does not yet allow its users to log ' + \
'into %(domain)s with their academic ' + \
'credentials. Please contact %(contact_email)s' + \
' for more information.'
SHIBBOLETH_MISSING_NAME = 'Missing user name in request.'
SIGN_TERMS = 'You have to agree with the terms.'
......
......@@ -86,7 +86,10 @@ def login(
try:
eppn = tokens.get(Tokens.SHIB_EPPN)
if not eppn:
raise KeyError(_(astakos_messages.SHIBBOLETH_MISSING_EPPN))
raise KeyError(_(astakos_messages.SHIBBOLETH_MISSING_EPPN) % {
'domain': settings.BASEURL,
'contact_email': settings.DEFAULT_CONTACT_EMAIL
})
if Tokens.SHIB_DISPLAYNAME in tokens:
realname = tokens[Tokens.SHIB_DISPLAYNAME]
elif Tokens.SHIB_CN in tokens:
......
......@@ -152,7 +152,10 @@ class ShibbolethTests(TestCase):
# shibboleth views validation
# eepn required
r = client.get('/im/login/shibboleth?', follow=True)
self.assertContains(r, messages.SHIBBOLETH_MISSING_EPPN)
self.assertContains(r, messages.SHIBBOLETH_MISSING_EPPN % {
'domain': astakos_settings.BASEURL,
'contact_email': astakos_settings.DEFAULT_CONTACT_EMAIL
})
client.set_tokens(eppn="kpapeppn")
astakos_settings.SHIBBOLETH_REQUIRE_NAME_INFO = True
......
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