Esempio n. 1
0
def login_write():
    form = LoginForm(request.form)
    user = UserInterface.get_by_username(form.username.data)
    if not user:
        user = UserInterface.get_by_email(form.username.data)
    if not user:
        flash('Unknown username/password combination.')
        return render_template("decanter/admin/login.html", form=form)

    if not user.verify_password(form.password.data):
        flash('Unknown username/password combination.')
        return render_template("decanter/admin/login.html", form=form)
    login_user(user, remember=True)
    return redirect(request.args.get('next') or '/')
Esempio n. 2
0
 def load_user(userid):
     if isinstance(userid, int):
         user = UserInterface.get_by_id(userid)
     else:
         user = UserInterface.get_by_username(userid)
     return user