Exemple #1
0
def view_login(request):
    if request.url == route_url('view_login', request):
        came_from = request.params.get('came_from', '/')
    else:
        came_from = request.params.get('came_from', request.url)

    resp_gen = LoginResponseGenerator(came_from)
    fes = forms.FormEvaluatorSubject(request, forms.get_login_form())
    fes.add_observer(resp_gen)
    fes.evaluate_form()
    return resp_gen.response
Exemple #2
0
 def _observe_no_submission(self, subj):
     self.response = { 'url': subj.request.application_url + '/view_login',
                       'form': forms.get_login_form().render(appstruct={'came_from': 
                                                                        self.came_from, }),
                       'resources': forms.form_resources(forms.get_login_form()),
                       }
Exemple #3
0
 def _observe_form_invalid(self, subj):
     self.response = {'form': subj.exception.render(), 
                      'resources': forms.form_resources(forms.get_login_form()),
                      }