def handleLogin(self, username, password, push_id=None): """ Handles the login process for the given username and password, rejecting or logging in the respective login model. """ # Verify we have at least one set of credentials. if not username: return jsonify(err="Invalid username") if not password: return jsonify(err="Invalid password") # Perform the login process itself. try: token_data = login_service.performLoginFromCredentials(username, password, push_id) except Exception, e: return jsonify(err=str(e))
def handleLogin(self, username, password, push_id=None): """ Handles the login process for the given username and password, rejecting or logging in the respective login model. """ # Verify we have at least one set of credentials. if not username: return jsonify(err="Invalid username") if not password: return jsonify(err="Invalid password") # Perform the login process itself. try: token_data = login_service.performLoginFromCredentials( username, password, push_id) except Exception, e: return jsonify(err=str(e))
login_service.performLogout(login_obj) def handleUserSignup(self, username, password, payment_nonce): """ Signs up the User with the given username and password. """ # Perform the signup. try: user_login = login_service.performUserSignup( username, password, payment_nonce) except Exception, e: return jsonify(err=str(e)) # Login the User automatically. try: login_obj = login_service.performLoginFromCredentials( username, password) except Exception, e: return jsonify(err=str(e)) # Create the message details to return to the User. success_message = "Your are now signed up." # TODO: Send confirmation mail communication to the User. return jsonify( msg=("User '%s' Successfully signed up to the system!" % username) + (" You can now <a href='/auth/user/'>login</a>"), successMsg=success_message) # Create and initialize the controller for the Auth API.
""" login_service.performLogout(login_obj) def handleUserSignup(self, username, password, payment_nonce): """ Signs up the User with the given username and password. """ # Perform the signup. try: user_login = login_service.performUserSignup(username, password, payment_nonce) except Exception, e: return jsonify(err=str(e)) # Login the User automatically. try: login_obj = login_service.performLoginFromCredentials(username, password) except Exception, e: return jsonify(err=str(e)) # Create the message details to return to the User. success_message = "Your are now signed up." # TODO: Send confirmation mail communication to the User. return jsonify(msg=("User '%s' Successfully signed up to the system!" % username) + (" You can now <a href='/auth/user/'>login</a>"), successMsg=success_message)