def handle_custom_login(self): email = self.request.get('email') password = self.request.get('password') logging.info('Custom Login:: ') logging.info(email) user = User.get_by_key_name(email) if user and ThirdPartyUser.for_user(user).count() > 0: response = {"success": False, "error": "You have previously logged in with Facebook. Please log in using Facebook."} return response device_token = self.request.get('token_hex') if user and self.check_password(email, password): User.update(email, device_token=device_token) util.set_session(email) response = {"success": True, "email": email, "first_name": user.first_name, "last_name": user.last_name} else: response = {"success": False, "error": "The email or password you entered is incorrect."} return response
def _get_third_party_names(user): other_names = [] for third_party_user in ThirdPartyUser.for_user(user): if third_party_user.id != user.name: other_names.append(third_party_user.id) return other_names