예제 #1
0
 public ActionResult PasswordChange(string NewPassword, string Password, string ConfirmPassword)
 {
     try
     {
         if (NewPassword.Length < 6 || Password.Length < 6 || ConfirmPassword.Length < 6)
         {
             ModelState.AddModelError(string.Empty, "パスワードの長さが最低6桁をに入力ください。");
             TempData["ViewData"] = ViewData;
             return(RedirectToAction("PasswordChange"));
         }
         if (!Password.Equals(ConfirmPassword))
         {
             ModelState.AddModelError(string.Empty, "パスワードと確認パスワードが同じではないです。");
             TempData["ViewData"] = ViewData;
             return(RedirectToAction("PasswordChange"));
         }
         PasswordService     passwordService = new PasswordService();
         EmployeeLoginOutput employee        = (EmployeeLoginOutput)Session["employee"];
         string employeeId = employee.Id;
         passwordService.ChangePassword(employeeId, Password, NewPassword);
         TempData["SuccessMessage"] = "パスワード変更ができました";
         TempData["ViewData"]       = ViewData;
     }
     catch (Exception e)
     {
         ModelState.AddModelError(string.Empty, e.Message);
         TempData["ViewData"] = ViewData;
         return(RedirectToAction("PasswordChange"));
     }
     return(RedirectToAction("PasswordChange"));
 }
        public void ChangeCustomerPassword(int customerId, string oldPassword, string newPassword)
        {
            CustomerViewModel customer = Map.CustomerModelToCustomerViewModel(_service.GetCustomerById(customerId));
            int isAuthorized           = _service.CheckCustomerLogin(customer.EMail, oldPassword);

            if (isAuthorized != 0)
            {
                PasswordService passwordService = new PasswordService();

                passwordService.ChangePassword(Map.CustomerViewModelToCustomerModel(customer), newPassword);
            }
        }
예제 #3
0
        public HttpStatusCode ChangePassword([FromBody] ChangePasswordDTO model)
        {
            var result = _pass.ChangePassword(model);

            return(validateResult(result));
        }
 public async Task <HttpResponseMessage> ChangePassword([FromBody] ChangePasswordDto dto)
 {
     return(await Execute(async() => await PasswordService.ChangePassword(dto)));
 }