Changeset 10405
- Timestamp:
- 5 Jul 2013, 10:38:08 (11 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/server.py
r10403 r10405 87 87 88 88 89 def set_session_cookie( response, db):89 def set_session_cookie(db, response): 90 90 """Create a session cookie (ticket granting cookie) on `response`. 91 91 … … 165 165 resp = Response(html) 166 166 if not sso: 167 resp = set_session_cookie( resp, db)167 resp = set_session_cookie(db, resp) 168 168 return resp 169 169 … … 212 212 valid_lt = check_login_ticket(self.db, req.POST.get('lt')) 213 213 tgc = check_session_cookie(self.db, req.cookies.get('cas-tgc', None)) 214 if username and password and valid_lt or tgc: 214 if tgc: 215 if service: 216 return login_redirect_service(self.db, service) 217 else: 218 return login_success_no_service( 219 self.db, 'You logged in already.', True) 220 if username and password and valid_lt: 215 221 # act as credentials acceptor 216 if tgc: 217 cred_ok, reason = True, '' 218 if not service: 219 msg = 'You logged in already.' 220 else: 221 cred_ok, reason = self.auth.check_credentials( 222 username, password) 222 cred_ok, reason = self.auth.check_credentials( 223 username, password) 223 224 if cred_ok: 224 225 if service is None: 225 226 # show logged-in screen 226 sso = (tgc is not None) 227 return login_success_no_service(self.db, msg, sso) 227 return login_success_no_service(self.db, msg, False) 228 228 else: 229 229 # safely redirect to service given -
main/waeup.cas/trunk/waeup/cas/tests/test_server.py
r10404 r10405 289 289 # make sure we can add session cookies to responses 290 290 db = DB('sqlite:///') 291 resp = set_session_cookie( Response(), db)291 resp = set_session_cookie(db, Response()) 292 292 assert 'Set-Cookie' in resp.headers 293 293 cookie = resp.headers['Set-Cookie']
Note: See TracChangeset for help on using the changeset viewer.