Show More
@@ -167,17 +167,25 b' class ProjectDashboardHandler(AuthenticatedHandler):' | |||
|
167 | 167 | |
|
168 | 168 | class LoginHandler(AuthenticatedHandler): |
|
169 | 169 | |
|
170 |
def |
|
|
170 | def _render(self, message=''): | |
|
171 | 171 | self.render('login.html', |
|
172 | 172 | next=self.get_argument('next', default='/'), |
|
173 | 173 | read_only=self.read_only, |
|
174 | message=message | |
|
174 | 175 | ) |
|
175 | 176 | |
|
177 | def get(self): | |
|
178 | self._render() | |
|
179 | ||
|
176 | 180 | def post(self): |
|
177 | 181 | pwd = self.get_argument('password', default=u'') |
|
178 |
if self.application.password |
|
|
179 |
|
|
|
182 | if self.application.password: | |
|
183 | if passwd_check(self.application.password, pwd): | |
|
180 | 184 | self.set_secure_cookie('username', str(uuid.uuid4())) |
|
185 | else: | |
|
186 | self._render(message='Invalid password') | |
|
187 | return | |
|
188 | ||
|
181 | 189 | self.redirect(self.get_argument('next', default='/')) |
|
182 | 190 | |
|
183 | 191 |
@@ -101,3 +101,15 b'' | |||
|
101 | 101 | -moz-box-pack: center; |
|
102 | 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 | 33 | #content_toolbar { |
|
34 |
padding: |
|
|
34 | padding: 5px; | |
|
35 | 35 | height: 25px; |
|
36 | 36 | line-height: 25px; |
|
37 | 37 | } |
@@ -31,6 +31,12 b'' | |||
|
31 | 31 | </div> |
|
32 | 32 | |
|
33 | 33 | <div id="content_panel"> |
|
34 | {% if message %} | |
|
35 | <div id="message"> | |
|
36 | {{message}} | |
|
37 | </div> | |
|
38 | {% end %} | |
|
39 | ||
|
34 | 40 | <form action="/login?next={{url_escape(next)}}" method="post"> |
|
35 | 41 | Password: <input type="password" name="password"> |
|
36 | 42 | <input type="submit" value="Sign in" id="signin"> |
General Comments 0
You need to be logged in to leave comments.
Login now