Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class OpenIdLoginHandler(webapp.RequestHandler):
- def get(self):
- continue_url = self.request.GET.get('continue', '/')
- username, password = None, None
- # see if we have gotten some Form Data
- if not (username and password):
- username = self.request.get('username').strip()
- password = self.request.get('password').strip()
- # verify password
- if username:
- credential = models.Credential.get_by_key_name(username)
- if credential and credential.secret == password:
- # successfull login
- session = get_current_session()
- if session.is_active():
- session.terminate() # clean previous session
- session['uid'] = credential.uid
- # redirect back where we came from
- if not continue_url:
- continue_url = '/'
- self.redirect(continue_url)
- return
- # Render Template with Login form
- path = os.path.join(os.path.dirname(__file__), 'templates/login.html')
- self.response.out.write(template.render(path, {'continue': continue_url, 'domains': ALLOWED_DOMAINS}))
Add Comment
Please, Sign In to add comment