Changeset 8789


Ignore:
Timestamp:
23/08/13 16:54:28 (6 years ago)
Author:
mnagni
Message:

Incomplete - # 22737: [CEDA Site Python Port] Resource Registration - Make Agreement Docs PDFs
 http://team.ceda.ac.uk/trac/ceda/ticket/22737

Adds a on_failure which should catch some, until now, uncatched errors

Location:
mauRepo/dj_security/trunk/dj_security
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/dj_security/trunk/dj_security/urls.py

    r8788 r8789  
    44from django.conf import settings 
    55from dj_security.views.dj_security_login import signin, CEDAAuthenticationForm,\ 
    6     signin_success 
     6    signin_success, signin_failure 
    77from django_authopenid import views as oid_views 
    88 
     
    9898    url(r'^account/signin/$', signin, name='user_signin',  
    9999        kwargs={'auth_form':CEDAAuthenticationForm,  
    100                 'template_name': 'signin.html', 'redirect_field_name': 'r'}), 
     100                'template_name': 'signin.html', 'redirect_field_name': 'r', 
     101                'on_failure': signin_failure}), 
    101102    url(r'^account/signin/complete/$', oid_views.complete_signin, name='user_complete_signin',  
    102103        kwargs={'on_success': signin_success, 'redirect_field_name': 'r'}),                         
  • mauRepo/dj_security/trunk/dj_security/views/dj_security_login.py

    r8788 r8789  
    187187    }, context_instance=_build_context(request, extra_context=extra_context))   
    188188 
     189def signin_failure(request, message, template_name='signin.html', 
     190        redirect_field_name=REDIRECT_FIELD_NAME, openid_form=OpenidSigninForm,  
     191        auth_form=AuthenticationForm, extra_context=None, **kwargs): 
     192    messages.add_message(request, messages.WARNING, message) 
     193    LOGGER.warn(message) 
     194    return render(template_name, { 
     195        'msg': message, 
     196        'form1': openid_form(), 
     197        'form2': auth_form(), 
     198        redirect_field_name: request.REQUEST.get(redirect_field_name, '') 
     199    }, context_instance=_build_context(request, extra_context))      
     200 
    189201def signin_success(request, identity_url, openid_response, 
    190202        redirect_field_name=REDIRECT_FIELD_NAME, **kwargs): 
Note: See TracChangeset for help on using the changeset viewer.