def on_success(request, identity_url, openid_response): # We need to behave differently from the default AuthConsumer # success behaviour. For simplicity, we do the following: # 1. "Log them in" as that OpenID i.e. stash it in the session # 2. If it's already associated with an account, log them in as # that account and show a message. # 2. If NOT already associated, redirect back to /register/ again openid_object = OpenID.from_openid_response(openid_response) matches = self.lookup_openid(request, identity_url) if matches: # Log them in and show the message self.log_in_user(request, matches[0]) response = self.show_i_have_logged_you_in(request) else: response = HttpResponseRedirect(urlparse.urljoin(request.path, "../register/")) self.persist_openid(request, response, openid_object) return response
def on_success(request, identity_url, openid_response): # We need to behave differently from the default AuthConsumer # success behaviour. For simplicity, we do the following: # 1. "Log them in" as that OpenID i.e. stash it in the session # 2. If it's already associated with an account, log them in as # that account and show a message. # 2. If NOT already associated, redirect back to /register/ again openid_object = OpenID.from_openid_response(openid_response) matches = self.lookup_openid(request, identity_url) if matches: # Log them in and show the message self.log_in_user(request, matches[0]) response = self.show_i_have_logged_you_in(request) else: response = HttpResponseRedirect( urlparse.urljoin(request.path, '../register/')) self.persist_openid(request, response, openid_object) return response
def on_success(self, request, identity_url, openid_response): openid_object = OpenID.from_openid_response(openid_response) response = self.on_logged_in(request, identity_url, openid_response) self.persist_openid(request, response, openid_object) return response