public ActionResult InputCompanyCode() { if (!TempData.ContainsKey(TEMPDATA_EMAIL)) { return(RedirectToAction("PasswordReissue", "PMS01001")); } var tmp = TempData[TEMPDATA_EMAIL] as TmpValues; var model = new CompanyCodeViewModel(); model.Email = tmp.Email; return(View(model)); }
public ActionResult InputCompanyCode(CompanyCodeViewModel model) { bool isError = true; if (ModelState.IsValid) { var user = _service.CheckEmail(model.Email, model.CompanyCode); if (user != null) { using (TransactionScope transaction = new TransactionScope()) { DateTime now = Utility.GetCurrentDateTime(); string param_value = SafePassword.GetSha256(model.Email + user.company_code + now.ToString("yyyy/MM/dd HH:mm:ss")); int count = _service.UpdatePasswordResetManagement(model.Email, param_value, now, user.company_code); //Sent mail new password if (count > 0) { var objSentMail = new SentMailAuto(); if (objSentMail.SentMail(model.Email, param_value, user.user_account) > 0) { transaction.Complete(); TempData["PasswordReissueSucess"] = Resources.Messages.I001; isError = false; } else { ModelState.AddModelError("", Resources.Messages.E012); } } } } else { ModelState.AddModelError("", String.Format(Resources.Messages.E007, "企業コード", "企業コード")); } } if (!isError) { return(RedirectToAction("InputCompanyCode", "PMS01001")); } return(View(model)); }