Revision 7dc5bd0c flowspec/views.py

b/flowspec/views.py
287 287
        username = request.META['HTTP_EPPN']
288 288
        if not username:
289 289
            error_username = True
290
        firstname = request.META['HTTP_SHIB_INETORGPERSON_GIVENNAME']
291
        lastname = request.META['HTTP_SHIB_PERSON_SURNAME']
292
        mail = request.META['HTTP_SHIB_INETORGPERSON_MAIL']
290
        firstname = lookupShibAttr(settings.SHIB_FIRSTNAME, request.META)
291
        lastname = lookupShibAttr(settings.SHIB_LASTNAME, request.META)
292
        mail = lookupShibAttr(settings.SHIB_MAIL, request.META)
293
        entitlement = lookupShibAttr(settings.SHIB_ENTITLEMENT, request.META)
293 294
        organization = request.META['HTTP_SHIB_HOMEORGANIZATION']
294
        entitlement = request.META['HTTP_SHIB_EP_ENTITLEMENT']
295
        
295 296
        if settings.SHIB_AUTH_ENTITLEMENT in entitlement.split(";"):
296 297
            has_entitlement = True
297 298
        if not has_entitlement:
......
341 342
            error = _("Something went wrong during user authentication. Contact your administrator")
342 343
            return render_to_response('error.html', {'error': error,},
343 344
                                  context_instance=RequestContext(request))
344
    except Exception:
345
        error = _("Invalid login procedure")
345
    except Exception as e:
346
        error = _("Invalid login procedure. Error: %s" %e)
346 347
        return render_to_response('error.html', {'error': error,},
347 348
                                  context_instance=RequestContext(request))
348 349
        # Return an 'invalid login' error message.
......
438 439
def send_new_mail(subject, message, from_email, recipient_list, bcc_list):
439 440
    return EmailMessage(subject, message, from_email, recipient_list, bcc_list).send()
440 441

  
442

  
443
def lookupShibAttr(attrmap, requestMeta):
444
    for attr in attrmap:
445
        if attr in requestMeta:
446
            return requestMeta[attr]
447
    return ''

Also available in: Unified diff