示例#1
0
 def process_form(self):
     """Read the form, create the user if valid, and log him in."""
     form = self.context.get('form')
     
     if form.validate():
         r = self.create_researcher(form)
         log_user_in(r)
         return redirect(url_for('user.index', username=r.username))
示例#2
0
 def process_form(self):
     """Verify provided credentials and log the user in if valid."""
     form = self.context.get('form')
     
     if form.validate():
         r = self.verify_credentials(form)
         
         if not r:
             return render_template('login.html', **self.context)
         
         log_user_in(r)
         redir_url = self.context.get('return_to',
                             url_for('user.index', username=r.username))
         return redirect(redir_url)