take into account ?next param in login
This commit is contained in:
parent
e651e70d2d
commit
b476e207fa
|
@ -21,12 +21,18 @@ class LoginForm(FlaskForm):
|
||||||
"10/minute", deduct_when=lambda r: hasattr(g, "deduct_limit") and g.deduct_limit
|
"10/minute", deduct_when=lambda r: hasattr(g, "deduct_limit") and g.deduct_limit
|
||||||
)
|
)
|
||||||
def login():
|
def login():
|
||||||
|
next_url = request.args.get("next")
|
||||||
|
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
LOG.d("user is already authenticated, redirect to dashboard")
|
if next_url:
|
||||||
return redirect(url_for("dashboard.index"))
|
LOG.debug("user is already authenticated, redirect to %s", next_url)
|
||||||
|
return redirect(next_url)
|
||||||
|
else:
|
||||||
|
LOG.d("user is already authenticated, redirect to dashboard")
|
||||||
|
return redirect(url_for("dashboard.index"))
|
||||||
|
|
||||||
form = LoginForm(request.form)
|
form = LoginForm(request.form)
|
||||||
next_url = request.args.get("next")
|
|
||||||
show_resend_activation = False
|
show_resend_activation = False
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
|
|
Loading…
Reference in New Issue