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