Guest User

Untitled

a guest
Jan 19th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. forms.py:
  2. class OnlyActiveAuthenticationForm(AuthenticationForm):
  3.     def confirm_login_allowed(self, user):
  4.  
  5.         if user.state == 'deactivated':
  6.             raise forms.ValidationError(_(u'Tento účet je deaktivovaný, kontaktujte správce Vaší firmy'),
  7.                                         code='deactivated',
  8.             )
  9. urls.py:
  10. from django.contrib.auth.views import login
  11. url(r'^login/$', login, {'authentication_form': OnlyActiveAuthenticationForm}, name='login'),
Advertisement
Add Comment
Please, Sign In to add comment