public static ResponseDto CheckOTP(CheckOtpRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; response.has_resource = 0; try { using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindByMobileNumber(request.mobile_number); //agentBoss = GetAuthAgentBoss(request.user_id, request.auth_token, response); //agentBoss = GetAuthAgentBossNotAuthToken(request.user_id, response); if (agentBoss == null) { MakeNouserResponse(response); return(response); } bool otpValid = OTPServices.ValidateOTP(agentBoss.AbosID, request.otp_code); OTPServices.RemoveOTP(agentBoss.AbosID, request.otp_code);// Either way remove this otp if it exists. if (otpValid) { agentBoss.StatusId = true; dao.Update(agentBoss); response.code = 0; response.message = MessagesSource.GetMessage("otp.valid"); response.has_resource = 1; return(response); } response.code = 1; response.message = MessagesSource.GetMessage("otp.not.valid"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }
//public ForgotPasswordResponse ForgotPassword(ForgotPasswordRequest request) //{ // ForgotPasswordResponse response = new ForgotPasswordResponse(); // string newPassword = TokenGenerator.GenerateResetPassword(); // Driver drv = null; // try // { // using (DriverDao dao = new DriverDao()) // { // drv = dao.FindByMobileNumber(request.mobile_number); // drv.Password = TokenGenerator.GetHashedPassword(newPassword, 49); // dao.Update(drv); // OTPServices.SendPasswordMessage(drv.MobileNumber, newPassword); // response.code = 0; // response.has_resource = 1; // response.reset_password = new ResetPasswordDto(); // response.reset_password.password_otp_sent = 1; // response.reset_password.password_reset = 1; // response.message = MessagesSource.GetMessage("passwd.reset"); // } // } // catch (Exception ex) // { // response.MakeExceptionResponse(ex); // } // return response; //} public ResponseDto CheckOTP(CheckOtpRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); ResponseDto response = new ResponseDto(); Driver driver = null; response.has_resource = 0; try { using (DriverDao dao = new DriverDao()) { driver = dao.FindByMobileNumber(request.mobile_number); if (driver == null) { MakeNoDriverResponse(response); return(response); } bool otpValid = OTPServices.ValidateOTP(driver.DrvrID, request.otp_code); OTPServices.RemoveOTP(driver.DrvrID, request.otp_code);// Either way remove this otp if it exists. if (otpValid) { driver.StatusId = true; dao.Update(driver); response.code = 0; response.message = MessagesSource.GetMessage("otp.valid"); response.has_resource = 1; return(response); } response.code = 1; response.message = MessagesSource.GetMessage("otp.not.valid"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); } return(response); }
public static ResponseDto CheckOtp(CheckOtpRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); ResponseDto response = new ResponseDto(); SuperAdmin superuser = null; response.has_resource = 0; try { using (SuperUserDao dao = new SuperUserDao()) { superuser = GetAuthUserbyMobileNumber(request.mobile_number); if (superuser == null) { MakeNouserResponse(response); return(response); } bool otpValid = OTPServices.ValidateOTP(superuser.SAdminID, request.otp_code); OTPServices.RemoveOTP(superuser.SAdminID, request.otp_code);// Either way remove this otp if it exists. if (otpValid) { dao.Update(superuser); response.code = 0; response.message = MessagesSource.GetMessage("otp.valid"); return(response); } response.code = 1; response.message = MessagesSource.GetMessage("otp.not.valid"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }