Notify user about invalid password.

This commit is contained in:
Stefan van der Walt 2011-11-18 12:04:17 -08:00
parent b2972a7e98
commit 15520ba820
3 changed files with 19 additions and 5 deletions

View File

@ -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='/'))

View File

@ -31,7 +31,7 @@ body {
}
#content_toolbar {
padding: 10px 5px 5px 5px;
padding: 5px;
height: 25px;
line-height: 25px;
}

View File

@ -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">