mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-25 02:57:22 +00:00
leave fields filled after invalid login attempt
This commit is contained in:
parent
6afb429185
commit
189da65fac
@ -7,11 +7,11 @@
|
|||||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username">{{_('Username')}}</label>
|
<label for="username">{{_('Username')}}</label>
|
||||||
<input type="text" class="form-control" id="username" name="username" autocapitalize="off" placeholder="{{_('Username')}}">
|
<input type="text" class="form-control" id="username" name="username" autocapitalize="off" placeholder="{{_('Username')}}" value="{{ username }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">{{_('Password')}}</label>
|
<label for="password">{{_('Password')}}</label>
|
||||||
<input type="password" class="form-control" id="password" name="password" placeholder="{{_('Password')}}">
|
<input type="password" class="form-control" id="password" name="password" placeholder="{{_('Password')}}" value="{{ password }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
|
@ -1285,7 +1285,7 @@ def handle_login_user(user, remember, message, category):
|
|||||||
return redirect_back(url_for("web.index"))
|
return redirect_back(url_for("web.index"))
|
||||||
|
|
||||||
|
|
||||||
def render_login():
|
def render_login(username="", password=""):
|
||||||
next_url = request.args.get('next', default=url_for("web.index"), type=str)
|
next_url = request.args.get('next', default=url_for("web.index"), type=str)
|
||||||
if url_for("web.logout") == next_url:
|
if url_for("web.logout") == next_url:
|
||||||
next_url = url_for("web.index")
|
next_url = url_for("web.index")
|
||||||
@ -1293,6 +1293,8 @@ def render_login():
|
|||||||
title=_("Login"),
|
title=_("Login"),
|
||||||
next_url=next_url,
|
next_url=next_url,
|
||||||
config=config,
|
config=config,
|
||||||
|
username=username,
|
||||||
|
password=password,
|
||||||
oauth_check=oauth_check,
|
oauth_check=oauth_check,
|
||||||
mail=config.get_mail_server_configured(), page="login")
|
mail=config.get_mail_server_configured(), page="login")
|
||||||
|
|
||||||
@ -1373,7 +1375,7 @@ def login_post():
|
|||||||
else:
|
else:
|
||||||
log.warning('Login failed for user "{}" IP-address: {}'.format(form['username'], ip_address))
|
log.warning('Login failed for user "{}" IP-address: {}'.format(form['username'], ip_address))
|
||||||
flash(_(u"Wrong Username or Password"), category="error")
|
flash(_(u"Wrong Username or Password"), category="error")
|
||||||
return render_login()
|
return render_login(form.get("username", ""), form.get("password", ""))
|
||||||
|
|
||||||
|
|
||||||
@web.route('/logout')
|
@web.route('/logout')
|
||||||
|
Loading…
Reference in New Issue
Block a user