Changed the signature of the login hijack signal.
[django-cas-provider.git] / cas_provider / forms.py
1 from django import forms
2
3
4 class LoginForm(forms.Form):
5     email = forms.CharField(widget=forms.TextInput(attrs={'autofocus': 'autofocus',
6                                                           'max_length': '255'}))
7     password = forms.CharField(widget=forms.PasswordInput)
8     service = forms.CharField(widget=forms.HiddenInput, required=False)
9     remember_me = forms.BooleanField(required=False, label="Keep me signed in",
10                                      widget=forms.CheckboxInput(attrs={'class': 'remember_me'}))
11
12     def __init__(self, *args, **kwargs):
13         # renew = kwargs.pop('renew', None)
14         # gateway = kwargs.pop('gateway', None)
15         request = kwargs.pop('request', None)
16         super(LoginForm, self).__init__(*args, **kwargs)
17         self.request = request
18
19     def clean_remember_me(self):
20         remember = self.cleaned_data['remember_me']
21         if not remember and self.request is not None:
22             self.request.session.set_expiry(0)
23             
24
25 class MergeLoginForm(LoginForm):
26     email = forms.CharField(max_length=255, widget=forms.HiddenInput)