//[ResponseType(typeof(DedicationRegistryEntity))] public async Task <HttpResponseMessage> VerifyRestoreCode(string email, string code) { try { HttpResponseMessage response; string errorMessage; if (_UserRestoreLogic.IsValidCode(email, code, out errorMessage)) { response = Request.CreateResponse(HttpStatusCode.OK, true); } else { response = Request.CreateResponse(HttpStatusCode.PreconditionFailed, new { Message = errorMessage }); } return(response); } catch (Exception ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error al verificar el codigo para restaurar su contraseña")); } }
static void Main(string[] args) { LanguageLogic languageLogic = new LanguageLogic(); UserLogic userLogic = new UserLogic(); UserFleetLogic userFleetLogic = new UserFleetLogic(); FleetLogic fleetLogic = new FleetLogic(); VehicleLogic vehicleLogic = new VehicleLogic(); DriverLogic driverLogic = new DriverLogic(); ConfigTagLogic configTagLogic = new ConfigTagLogic(); ConfigTagLanguageCrud configTagLanguageCrud = new ConfigTagLanguageCrud(); FunctionsLogic functionsLogic = new FunctionsLogic(); ConfigUserLoginLogic configUserLoginLogic = new ConfigUserLoginLogic(); Mail mail = new Mail(); UserRestoreLogic userRestoreLogic = new UserRestoreLogic(); CarFleetSecurity secCarFleet = CarFleetSecurity.GetContext; //List<LanguageEntity> listLanguage = languageLogic.SelectAll(); //LanguageEntity languageEntity = languageLogic.GetById(1); //UserEntity userEntity = userLogic.Login("ManuelM"); //List<UserFleetEntity> listuserFleet = userFleetLogic.SelectByUserId(userEntity.Id); //List<FleetEntity> listFleet = fleetLogic.GetByCompanyId(userEntity.Id_company); //List<VehicleEntity> listVehicle = vehicleLogic.GetByCompanyId(userEntity.Id_company); //List<VehicleEntity> listVehicle2 = vehicleLogic.GetByFleetId(listFleet.FirstOrDefault().Id); //List<DriverEntity> listDriver = driverLogic.GetByCompanyId(userEntity.Id_company); //ConfigTagEntity configTagEntity=new ConfigTagEntity(); //configTagEntity.Tag_key = "lblUser"; //configTagEntity.Page_name = "Login"; //configTagLogic.Insert(configTagEntity); //int totalDriver = functionsLogic.GetTotalsByCompanyId(2099, Utils.Constants.CARFLEET_ENTITY.DRIVER); //int totalFleet= functionsLogic.GetTotalsByCompanyId(2099, Utils.Constants.CARFLEET_ENTITY.FLEET); //int totalVehicle = functionsLogic.GetTotalsByCompanyId(2099, Utils.Constants.CARFLEET_ENTITY.VEHICLE); //string token=configUserLoginLogic.Insert(4188, "", 1800); string pass = CarFleetSecurityCipher.Encrypt("ManuelM"); string passDecrypt = CarFleetSecurityCipher.Decrypt(pass); string email = "ManuelM"; List <string> addressList = new List <string>(); addressList.Add("*****@*****.**"); string errorMessage; UserEntity userEntity = userLogic.SelectByLoginName(email); if (userEntity != null) { Random random = new Random(); string code = random.Next(10000, 99999).ToString(); int timeExpiration = secCarFleet.GetNumberConfig(CarFleetSecurity.APP_CONFIG_RESTORE_PASSWORD_TIME_EXPIRE); if (userRestoreLogic.Insert(userEntity.Id, code, timeExpiration)) { Mail carFleetMail = new Mail(); var sendMail = carFleetMail.RestorePassword("*****@*****.**", code, out errorMessage); } if (userRestoreLogic.IsValidCode(email, code, out errorMessage)) { string newPassword = "******"; var updatePass = userLogic.UpdatePassword(email, newPassword); } } var f = 234; }