1 from django import forms
4 class LoginForm(forms.Form):
5 email = forms.CharField(widget=forms.TextInput(attrs={'autofocus': 'autofocus',
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'}))
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
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)
25 class MergeLoginForm(LoginForm):
26 email = forms.CharField(max_length=255, widget=forms.HiddenInput)