def post(self, request, app_code): ''' This will be used when login form will be submitted. @param request: HttpRequest for this operation @param app_code: Which app made this login request ''' log.info('[START]- Request Received for the Authentication.'); # First Decide Destination destination = request.GET.get('des', getDestinationByAppCode(app_code)); keepmelogin = '******' if request.POST.get('loggedinFlag') else 'N' # Get user Agent and IP USER_AGENT = UserAgent() user_ip, user_agent = USER_AGENT.get_client_ip(request), USER_AGENT.get_browser_agent(request); password, user_id = request.POST.get('password', None), request.POST.get('user_id', None); # pwdEncApi = EncryptionUtil(self.PASSWORD_KEY); # password = pwdEncApi.encryptText(password) errors = self.validateForm(user_id, password, user_ip, destination); if errors: # add Context and return to the page errors['app_code'] = app_code; errors['des'] = destination; log.info('[END]- Aborting Authentication request as user has given invalid data.'); return self.loginResponseMixIn(request, errors); # log.info('--->asasa->%s',validate_email(email)) # forms = {"type": "cookie","client_meta": "assmjhasjhaskashkashk","ip": '127.0.0.1', "prfid": "1234", "authid": "1", "prvauthid": "1", "token": "abcde", "prvtoken": "abcde","lgnid":"1"} sr_response = self.authenticate(user_agent, user_ip, user_id, password, keepmelogin); log.info('[END]- Authentication Request Completed, taking action based on the response.'); dev_mode = getattr(settings, "SKIP_WEB_CALL", 'n'); if dev_mode == 'y': return HttpResponse('SucessFully Logged in.'); return self.processResponse(request, sr_response, destination, app_code);
def get(self, request, app_code='1'): ''' This will be used for any login request landing for this page. It will set the cookie and return back. @param request: HttpRequest for the this view @param app_code: Application code which made request to login ''' log.info('[START]- Request will be redirected to login page.') # First check where user want to navigate after login process destination = request.GET.get('nxt', request.GET.get('des')) destination = destination if destination else getDestinationByAppCode(app_code); log.info('[END]- URL formation for the login page redirect completed.') return redirect('%s?des=%s' %(reverse('uim.login', kwargs={'app_code':app_code}), destination))
def get(self, request, app_code): ''' This will be used for any login request landing for this page. @param request: A HttpRequest which generate the call. @param app_code: Application Code where request coming from. ''' log.info('[START]- Request Received for the login page.') destination, forgotPasswordTab, _issues, forgotPasswordSubTab = request.GET.get( 'des', getDestinationByAppCode(app_code)), request.GET.get( 'fgp'), request.GET.get('itest'), request.GET.get('fgpm') #Ternary operator #destination = destination if destination else getDestinationByAppCode(app_code); log.info('[END]- Request Completed for the login page.') return self.loginResponseMixIn( request, self.buildLoginArgs(app_code, destination, forgotPasswordTab, forgotPasswordSubTab, _issues))
def post(self, request, app_code): ''' This will be used when login form will be submitted. @param request: HttpRequest for this operation @param app_code: Which app made this login request ''' log.info('[START]- Request Received for the Authentication.') # First Decide Destination destination = request.GET.get('des', getDestinationByAppCode(app_code)) keepmelogin = '******' if request.POST.get('loggedinFlag') else 'N' # Get user Agent and IP USER_AGENT = UserAgent() user_ip, user_agent = USER_AGENT.get_client_ip( request), USER_AGENT.get_browser_agent(request) password, user_id = request.POST.get('password', None), request.POST.get( 'user_id', None) # pwdEncApi = EncryptionUtil(self.PASSWORD_KEY); # password = pwdEncApi.encryptText(password) errors = self.validateForm(user_id, password, user_ip, destination) if errors: # add Context and return to the page errors['app_code'] = app_code errors['des'] = destination log.info( '[END]- Aborting Authentication request as user has given invalid data.' ) return self.loginResponseMixIn(request, errors) # log.info('--->asasa->%s',validate_email(email)) # forms = {"type": "cookie","client_meta": "assmjhasjhaskashkashk","ip": '127.0.0.1', "prfid": "1234", "authid": "1", "prvauthid": "1", "token": "abcde", "prvtoken": "abcde","lgnid":"1"} sr_response = self.authenticate(user_agent, user_ip, user_id, password, keepmelogin) log.info( '[END]- Authentication Request Completed, taking action based on the response.' ) dev_mode = getattr(settings, "SKIP_WEB_CALL", 'n') if dev_mode == 'y': return HttpResponse('SucessFully Logged in.') return self.processResponse(request, sr_response, destination, app_code)
def get(self, request, app_code): ''' This will be used for any login request landing for this page. @param request: A HttpRequest which generate the call. @param app_code: Application Code where request coming from. ''' log.info('[START]- Request Received for the login page.'); destination, forgotPasswordTab, _issues , forgotPasswordSubTab = request.GET.get('des', getDestinationByAppCode(app_code)), request.GET.get('fgp'), request.GET.get('itest'), request.GET.get('fgpm'); #Ternary operator #destination = destination if destination else getDestinationByAppCode(app_code); log.info('[END]- Request Completed for the login page.') return self.loginResponseMixIn(request, self.buildLoginArgs(app_code, destination, forgotPasswordTab, forgotPasswordSubTab, _issues));