

def form_valid(self, form):
    '\n        (2.2) As a credential acceptor, /login requires two parameters:\n\n        1. ``username``: the username provided by the client\n        2. ``password``: the password provided by the client\n\n        If authentication is successful, the single sign-on session is\n        created. If a service is provided, a ``ServiceTicket`` is\n        created and the client is redirected to the service URL with\n        the ``ServiceTicket`` included. If no service is provided, the\n        login page is redisplayed with a message indicating a\n        successful login.\n\n        If authentication fails, the login form is redisplayed with an\n        error message describing the reason for failure.\n\n        The credential acceptor accepts one optional parameter:\n\n        1. ``warn``: causes the user to be prompted when successive\n           authentication attempts occur within the single sign-on\n           session.\n        '
    login(self.request, form.user)
    logger.info(('Single sign-on session started for %s' % form.user))
    if form.cleaned_data.get('warn'):
        self.request.session['warn'] = True
    service = self.request.GET.get('service')
    if service:
        st = ServiceTicket.objects.create_ticket(service=service, user=self.request.user, primary=True)
        return redirect(service, params={
            'ticket': st.ticket,
        })
    return redirect('cas_login')

dataset/ETHPy150Open jbittel/django-mama-cas/mama_cas/views.py LoginView.form_valid/original