mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
Notify user about invalid password.
This commit is contained in:
parent
b2972a7e98
commit
15520ba820
@ -167,17 +167,25 @@ class ProjectDashboardHandler(AuthenticatedHandler):
|
||||
|
||||
class LoginHandler(AuthenticatedHandler):
|
||||
|
||||
def get(self):
|
||||
def _render(self, message=''):
|
||||
self.render('login.html',
|
||||
next=self.get_argument('next', default='/'),
|
||||
read_only=self.read_only,
|
||||
message=message
|
||||
)
|
||||
|
||||
def get(self):
|
||||
self._render()
|
||||
|
||||
def post(self):
|
||||
pwd = self.get_argument('password', default=u'')
|
||||
if self.application.password and \
|
||||
passwd_check(self.application.password, pwd):
|
||||
self.set_secure_cookie('username', str(uuid.uuid4()))
|
||||
if self.application.password:
|
||||
if passwd_check(self.application.password, pwd):
|
||||
self.set_secure_cookie('username', str(uuid.uuid4()))
|
||||
else:
|
||||
self._render(message='Invalid password')
|
||||
return
|
||||
|
||||
self.redirect(self.get_argument('next', default='/'))
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ body {
|
||||
}
|
||||
|
||||
#content_toolbar {
|
||||
padding: 10px 5px 5px 5px;
|
||||
padding: 5px;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
@ -31,6 +31,12 @@
|
||||
</div>
|
||||
|
||||
<div id="content_panel">
|
||||
{% if message %}
|
||||
<div id="message">
|
||||
{{message}}
|
||||
</div>
|
||||
{% end %}
|
||||
|
||||
<form action="/login?next={{url_escape(next)}}" method="post">
|
||||
Password: <input type="password" name="password">
|
||||
<input type="submit" value="Sign in" id="signin">
|
||||
|
Loading…
Reference in New Issue
Block a user