##// END OF EJS Templates
Add info, error and warning message boxes.
Stefan van der Walt -
Show More
@@ -174,7 +174,7 b' class ProjectDashboardHandler(AuthenticatedHandler):'
174
174
175 class LoginHandler(AuthenticatedHandler):
175 class LoginHandler(AuthenticatedHandler):
176
176
177 def _render(self, message=''):
177 def _render(self, message=None):
178 self.render('login.html',
178 self.render('login.html',
179 next=self.get_argument('next', default='/'),
179 next=self.get_argument('next', default='/'),
180 read_only=self.read_only,
180 read_only=self.read_only,
@@ -190,7 +190,7 b' class LoginHandler(AuthenticatedHandler):'
190 if passwd_check(self.application.password, pwd):
190 if passwd_check(self.application.password, pwd):
191 self.set_secure_cookie('username', str(uuid.uuid4()))
191 self.set_secure_cookie('username', str(uuid.uuid4()))
192 else:
192 else:
193 self._render(message='Invalid password')
193 self._render(message={'error': 'Invalid password'})
194 return
194 return
195
195
196 self.redirect(self.get_argument('next', default='/'))
196 self.redirect(self.get_argument('next', default='/'))
@@ -200,7 +200,7 b' class LogoutHandler(AuthenticatedHandler):'
200
200
201 def get(self):
201 def get(self):
202 self.clear_cookie('username')
202 self.clear_cookie('username')
203 self.render('logout.html')
203 self.render('logout.html', message={'info': 'Successfully logged out.'})
204
204
205
205
206 class NewHandler(AuthenticatedHandler):
206 class NewHandler(AuthenticatedHandler):
@@ -102,12 +102,27 b''
102 box-pack: center;
102 box-pack: center;
103 }
103 }
104
104
105 #message {
105 .message {
106 border: 1px solid red;
106 border-width: 1px;
107 background-color: #FFD3D1;
107 border-style: solid;
108 text-align: center;
108 text-align: center;
109 padding: 0.5em;
109 padding: 0.5em;
110 margin: 0.5em;
110 margin: 0.5em 0;
111 }
112
113 .message.error {
114 background-color: #FFD3D1;
115 border-color: red;
116 }
117
118 .message.warning {
119 background-color: #FFD09E;
120 border-color: orange;
121 }
122
123 .message.info {
124 background-color: #CBFFBA;
125 border-color: green;
111 }
126 }
112
127
113 #content_panel {
128 #content_panel {
@@ -42,10 +42,13 b''
42
42
43 <div id="content_panel">
43 <div id="content_panel">
44 {% if message %}
44 {% if message %}
45 <div id="message">
45
46 {{message}}
46 {% for key in message %}
47 <div class="message {{key}}">
48 {{message[key]}}
47 </div>
49 </div>
48 {% end %}
50 {% end %}
51 {% end %}
49
52
50 {% block content_panel %}
53 {% block content_panel %}
51 {% end %}
54 {% end %}
@@ -1,5 +1,5 b''
1 {% extends layout.html %}
1 {% extends layout.html %}
2
2
3 {% block content_panel %}
3 {% block content_panel %}
4 You've been successfully logged out.
4 Proceed to the <a href="/login">login page</a>.
5 {% end %}
5 {% end %}
General Comments 0
You need to be logged in to leave comments. Login now