##// END OF EJS Templates
Notify user about invalid password.
Stefan van der Walt -
Show More
@@ -167,17 +167,25 b' class ProjectDashboardHandler(AuthenticatedHandler):'
167
167
168 class LoginHandler(AuthenticatedHandler):
168 class LoginHandler(AuthenticatedHandler):
169
169
170 def get(self):
170 def _render(self, message=''):
171 self.render('login.html',
171 self.render('login.html',
172 next=self.get_argument('next', default='/'),
172 next=self.get_argument('next', default='/'),
173 read_only=self.read_only,
173 read_only=self.read_only,
174 message=message
174 )
175 )
175
176
177 def get(self):
178 self._render()
179
176 def post(self):
180 def post(self):
177 pwd = self.get_argument('password', default=u'')
181 pwd = self.get_argument('password', default=u'')
178 if self.application.password and \
182 if self.application.password:
179 passwd_check(self.application.password, pwd):
183 if passwd_check(self.application.password, pwd):
180 self.set_secure_cookie('username', str(uuid.uuid4()))
184 self.set_secure_cookie('username', str(uuid.uuid4()))
185 else:
186 self._render(message='Invalid password')
187 return
188
181 self.redirect(self.get_argument('next', default='/'))
189 self.redirect(self.get_argument('next', default='/'))
182
190
183
191
@@ -101,3 +101,15 b''
101 -moz-box-pack: center;
101 -moz-box-pack: center;
102 box-pack: center;
102 box-pack: center;
103 }
103 }
104
105 #message {
106 border: 1px solid red;
107 background-color: #FFD3D1;
108 text-align: center;
109 padding: 0.5em;
110 margin: 0.5em;
111 }
112
113 #content_panel {
114 margin: 0.5em;
115 } No newline at end of file
@@ -31,7 +31,7 b' body {'
31 }
31 }
32
32
33 #content_toolbar {
33 #content_toolbar {
34 padding: 10px 5px 5px 5px;
34 padding: 5px;
35 height: 25px;
35 height: 25px;
36 line-height: 25px;
36 line-height: 25px;
37 }
37 }
@@ -31,6 +31,12 b''
31 </div>
31 </div>
32
32
33 <div id="content_panel">
33 <div id="content_panel">
34 {% if message %}
35 <div id="message">
36 {{message}}
37 </div>
38 {% end %}
39
34 <form action="/login?next={{url_escape(next)}}" method="post">
40 <form action="/login?next={{url_escape(next)}}" method="post">
35 Password: <input type="password" name="password">
41 Password: <input type="password" name="password">
36 <input type="submit" value="Sign in" id="signin">
42 <input type="submit" value="Sign in" id="signin">
General Comments 0
You need to be logged in to leave comments. Login now