def changePassword(self, user_agent, ip, _email, _alt_email, useAsNewUidFlag, pid, rid, source, app_code, password, mode): ''' This will call the web-service to get the Password Reseted. @param usr_agent: User Agent of the Browser @param ip: IP address of the user @param _email: Email Id, which has been used for signup /id he has access to get the verification mail. @param _alt_email: Email Id, he has access to get the verification mail. @param useAsNewUidFlag: If User want to use alternative email as primary login id. @param pid: profile id Of the user. @param rid: request Id for this change password. @param source: Source through which change password approved. @param app_code: Application code from which its initiated. @param password: New Password. @param mode: Which mode user tried to reseting the password. @return: Return the response received from Web-service ''' # for the Data Form to be sent over network forms = {"mode": mode, "client_meta": user_agent, "ip": ip, "email": _email, "alt_email":_alt_email, "pwd": password, "change_new_uid_flag": useAsNewUidFlag, "pid":pid, "rid": rid, "source": source} data = urllib.urlencode(forms, doseq=True); # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None); WEB_BASE_URL += 'changepassword' # make instance of rest client client = RestClient(); return client.postWithAuthHeader(WEB_BASE_URL, data);
def authenticate(self, usr_agent, ip, usr_id, pwd, keepmelogin): ''' This will call the web-service to get the user authenticated. @param usr_agent: User Agent of the Browser @param ip: IP address of the user @param usr_id: User ID entered by the user. @param pwd: Password Entered by the user. @param keepmelogin: Keep me login flag, checked by the user @return: Return the response received from Web-service ''' # for the Data Form to be sent over network forms = { "type": "form", "client_meta": usr_agent, "ip": ip, "user_id": usr_id, "pwd": pwd, "keepmelogin": keepmelogin, "id_type": self.getTypeOfUserId(usr_id) } data = urllib.urlencode(forms, doseq=True) # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None) WEB_BASE_URL += 'auth' # make instance of rest client client = RestClient() return client.postWithAuthHeader(WEB_BASE_URL, data)
def requestForNewToken(self, app_code, mode, pid, rid, _email, _alt_email, user_ip, user_agent): ''' This will make the web-service call to send the new token mail. @param app_code: Application Code Where Request came from @param mode: The way user tries to reset the password, it might be by his own mail or by alternative email. @param pid: Profile Id of the user. @param rid: Request ID that has been previously created. @param _email: An Email ID, which he has registered @param _alt_email: AlterNative Email through which user wants the token. @param user_ip: Client IP @param user_agent: Client Agent. @return: A response message gets from the service call ''' # for the Data Form to be sent over network forms = { "mode": mode, "client_meta": user_agent, "ip": user_ip, "email": _email, "alt_email": _alt_email, "pid": pid, 'rid': rid, 'app': app_code } data = urllib.urlencode(forms, doseq=True) # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None) WEB_BASE_URL += 'forgotPassword/re-send/mail' # make instance of rest client client = RestClient() return client.postWithAuthHeader(WEB_BASE_URL, data)
def forgotPassword(self, user_agent, ip, _email, _alt_email, _recent_pwd, _reset_option, destination): ''' This will call the web-service to get the Password Reseted. @param usr_agent: User Agent of the Browser @param ip: IP address of the user @param email: Email Id, which has been used for signup /id he has access to get the verification mail. @param _alt_email: Email Id, he has access to get the verification mail. @param _recent_pwd: Most Recent Password he has been used in case he has lost access. @param _reset_option: mode might be 1 or 2, 1 means reseting by his own mail, 2 means reseting by other email. @param destination: A destination where user will be navigated back once validated. @return: Return the response received from Web-service ''' # for the Data Form to be sent over network forms = { "mode": _reset_option, "client_meta": user_agent, "ip": ip, "email": _email, "alt_email": _alt_email, "pwd": _recent_pwd, 'des': destination } data = urllib.urlencode(forms, doseq=True) # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None) WEB_BASE_URL += 'forgotPassword' # make instance of rest client client = RestClient() return client.postWithAuthHeader(WEB_BASE_URL, data)
def authenticate(self, usr_agent, ip, usr_id, pwd, keepmelogin): ''' This will call the web-service to get the user authenticated. @param usr_agent: User Agent of the Browser @param ip: IP address of the user @param usr_id: User ID entered by the user. @param pwd: Password Entered by the user. @param keepmelogin: Keep me login flag, checked by the user @return: Return the response received from Web-service ''' # for the Data Form to be sent over network forms = {"type": "form", "client_meta": usr_agent, "ip": ip, "user_id": usr_id, "pwd": pwd, "keepmelogin": keepmelogin, "id_type":self.getTypeOfUserId(usr_id)} data = urllib.urlencode(forms, doseq=True); # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None); WEB_BASE_URL += 'auth' # make instance of rest client client = RestClient(); return client.postWithAuthHeader(WEB_BASE_URL, data);
def forgotPassword(self, user_agent, ip, _email, _alt_email, _recent_pwd, _reset_option, destination): ''' This will call the web-service to get the Password Reseted. @param usr_agent: User Agent of the Browser @param ip: IP address of the user @param email: Email Id, which has been used for signup /id he has access to get the verification mail. @param _alt_email: Email Id, he has access to get the verification mail. @param _recent_pwd: Most Recent Password he has been used in case he has lost access. @param _reset_option: mode might be 1 or 2, 1 means reseting by his own mail, 2 means reseting by other email. @param destination: A destination where user will be navigated back once validated. @return: Return the response received from Web-service ''' # for the Data Form to be sent over network forms = {"mode": _reset_option, "client_meta": user_agent, "ip": ip, "email": _email, "alt_email":_alt_email, "pwd": _recent_pwd, 'des': destination} data = urllib.urlencode(forms, doseq=True); # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None); WEB_BASE_URL += 'forgotPassword' # make instance of rest client client = RestClient(); return client.postWithAuthHeader(WEB_BASE_URL, data);
def requestForNewToken(self, app_code, mode, pid, rid, _email, _alt_email, user_ip, user_agent): ''' This will make the web-service call to send the new token mail. @param app_code: Application Code Where Request came from @param mode: The way user tries to reset the password, it might be by his own mail or by alternative email. @param pid: Profile Id of the user. @param rid: Request ID that has been previously created. @param _email: An Email ID, which he has registered @param _alt_email: AlterNative Email through which user wants the token. @param user_ip: Client IP @param user_agent: Client Agent. @return: A response message gets from the service call ''' # for the Data Form to be sent over network forms = {"mode": mode, "client_meta": user_agent, "ip": user_ip, "email": _email, "alt_email":_alt_email, "pid": pid, 'rid': rid, 'app':app_code} data = urllib.urlencode(forms, doseq=True); # form the URL WEB_BASE_URL = getattr(settings, "REST_BASE_URL", None); WEB_BASE_URL += 'forgotPassword/re-send/mail' # make instance of rest client client = RestClient(); return client.postWithAuthHeader(WEB_BASE_URL, data);