Compatibility up to Django 2.1, dropped < 1.8. Removed unused code, fixed tests.
[django-cas-provider.git] / cas_provider / forms.py
1 from __future__ import unicode_literals
2
3 from django import forms
4 from django.utils.translation import ugettext_lazy as _
5
6
7 class LoginForm(forms.Form):
8     username = forms.CharField(widget=forms.TextInput(attrs={'autofocus': 'autofocus',
9                                                           'max_length': '255'}),
10                                label=_('Username'))
11     password = forms.CharField(widget=forms.PasswordInput(), label=_('Password'))
12     service = forms.CharField(widget=forms.HiddenInput, required=False)
13
14     def __init__(self, *args, **kwargs):
15         # renew = kwargs.pop('renew', None)
16         # gateway = kwargs.pop('gateway', None)
17         request = kwargs.pop('request', None)
18         super(LoginForm, self).__init__(*args, **kwargs)
19         self.request = request
20
21
22 class MergeLoginForm(LoginForm):
23     username = forms.CharField(max_length=255, widget=forms.HiddenInput,
24                                label=_('Username'))