Beispiel #1
0
        def login():
            f = PasswordLoginForm()
            if f.validate_on_submit():
                print "POSted to login"
                user = self.authenticate_user(f.username.data, f.password.data)
                if not user:
                    flash(_("Invalid username or password"), "danger")
                else:
                    login_user(user)
                    flash(_("Login successful"), "success")
                    return redirect(
                        request.args.get("next")
                        or url_for(current_appshell.root_view))

            return render_template('appshell/default_login.html', form=f)
Beispiel #2
0
        def login():
            f = PasswordLoginForm()
            if f.validate_on_submit():
                print "POSted to login"
                user = self.authenticate_user(f.username.data, f.password.data)
                if not user:
                    flash(_("Invalid username or password"), "danger")
                else:
                    login_user(user)
                    flash(_("Login successful"), "success")
                    return redirect(request.args.get("next") or 
                                    url_for(current_appshell.root_view))

            return render_template('appshell/default_login.html',
                                   form=f)
Beispiel #3
0
 def confirm_submit(self):
     flash(_("Data saved"), "success")
     if self.detail_endpoint:
         return redirect(url_for(self.detail_endpoint, id=self.obj.id))
     if self.listing_endpoint:
         return redirect(url_for(self.listing_endpoint))
Beispiel #4
0
 def logout():
     logout_user()
     flash(_("You have logged out"), "info")
     return redirect(url_for(current_appshell.root_view))
Beispiel #5
0
 def logout():
     logout_user()
     flash(_("You have logged out"), "info")
     return redirect(url_for(current_appshell.root_view))