912f184700984bff19cfdcf714b2d608b6832eba
[django-cas-provider.git] / cas_provider / forms.py
1 from django import forms
2 from django.utils.translation import ugettext_lazy as _
3 from utils import create_login_ticket
4
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
12     def __init__(self, service=None, renew=None, gateway=None, request=None, *args, **kwargs):
13         super(LoginForm, self).__init__(*args, **kwargs)
14         self.request = request
15         if service is not None:
16             self.fields['service'] = forms.CharField(widget=forms.HiddenInput, initial=service)