1 from django import forms
2 from django.contrib.auth.forms import AuthenticationForm
3 from django.contrib.auth import authenticate
4 from django.utils.translation import ugettext_lazy as _
6 from utils import create_login_ticket
8 class LoginForm(forms.Form):
9 username = forms.CharField(max_length=30, label=_('username'))
10 password = forms.CharField(widget=forms.PasswordInput, label=_('password'))
11 #warn = forms.BooleanField(required=False) # TODO: Implement
12 lt = forms.CharField(widget=forms.HiddenInput, initial=create_login_ticket)
13 def __init__(self, service=None, renew=None, gateway=None, request=None, *args, **kwargs):
14 super(LoginForm, self).__init__(*args, **kwargs)
15 self.request = request
16 if service is not None:
17 self.fields['service'] = forms.CharField(widget=forms.HiddenInput, initial=service)