def login(): form = LoginForm() if form.validate_on_submit(): user, checked = User.auth(form.userid.data, form.password.data) if checked: login_user(user) return redirect(request.args.get("next") or url_for("index")) flash('ユーザIDまたはパスワードが違います', 'danger') return render_template('auth/login.pug', form=form), 401 return render_template('auth/login.pug', form=form)
def verify_pw(username, password): user, checked = User.auth(username, password) return checked