Changeset 10397 for main/waeup.cas/trunk/waeup
- Timestamp:
- 4 Jul 2013, 12:52:19 (11 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/server.py
r10394 r10397 138 138 service = req.POST.get('service', req.GET.get('service', None)) 139 139 service_field = '' 140 msg = '' 140 141 username = req.POST.get('username', None) 141 142 password = req.POST.get('password', None) … … 143 144 if username and password and valid_lt: 144 145 # act as credentials acceptor 145 cred_ok = self.auth.check_credentials(username, password)146 cred_ok, reason = self.auth.check_credentials(username, password) 146 147 if cred_ok: 147 148 if service is None: … … 165 166 resp.text = html 166 167 return resp 168 else: 169 # login failed 170 msg = '<i>Login failed</i><br />Reason: %s' % reason 167 171 if service is not None: 168 172 service_field = ( … … 175 179 html = html.replace('LT_VALUE', lt.ticket) 176 180 html = html.replace('SERVICE_FIELD_VALUE', service_field) 181 html = html.replace('MSG_TEXT', msg) 177 182 return Response(html) 178 183 -
main/waeup.cas/trunk/waeup/cas/templates/login.html
r10394 r10397 4 4 </head> 5 5 <body> 6 <div id="msg"> 7 MSG_TEXT 8 </div> 6 9 Please enter your credentials to authenticate: 7 10 <form method="post"> -
main/waeup.cas/trunk/waeup/cas/tests/test_server.py
r10394 r10397 184 184 assert b'ticket=ST-' in resp.body 185 185 186 def test_login_cred_acceptor_failed(self): 187 # 2.2.4: failed login yields a message 188 lt = create_login_ticket() 189 self.raw_app.db.add(lt) 190 lt_string = lt.ticket 191 resp = self.app.post('/login', dict( 192 username='bird', password='cat', lt=lt_string)) 193 assert resp.status == '200 OK' 194 assert b'failed' in resp.body 195 186 196 187 197 class CASServerHelperTests(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.