Exemplo n.º 1
0
def login():
    next_url = request.args.get('next', "/")
    form = LoginForm()
    if form.validate_on_submit():
        form.login()
        return redirect(next_url)
    return render_template("account/login.html", form=form)
Exemplo n.º 2
0
def login():
    next_url = request.args.get('next', "/")
    form = LoginForm()
    if form.validate_on_submit():
        form.login()
        return redirect(next_url)
    return render_template("account/login.html", form=form)
Exemplo n.º 3
0
 def authorize(self):
     form = LoginForm()
     if not form.validate_on_submit():
         return jsonify(
             token="",
             msg="Wrong username/password"
         )
     user = form.user
     if not user.api_token:
         user.generate_api_token()
     return jsonify(
         token=user.api_token
     )