Saving the service protectively. Also using user from the request for socialauth...
[django-cas-provider.git] / cas_provider / forms.py
1 from django import forms
2 from django.contrib.auth.forms import AuthenticationForm
3 from django.contrib.auth import authenticate
4
5 from utils import create_login_ticket
6
7 class LoginForm(forms.Form):
8     email = forms.CharField(max_length=255)
9     password = forms.CharField(widget=forms.PasswordInput)
10     #warn = forms.BooleanField(required=False)  # TODO: Implement
11     lt = forms.CharField(widget=forms.HiddenInput, initial=create_login_ticket)
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)