Example #1
0
        public ActionResult ForgotPassword(string message)
        {
            ForgotPasswordModels model = new ForgotPasswordModels();

            ViewBag.ErrorMessage = message;
            return(View(model));
        }
Example #2
0
        public static ResponseModels ForgotPassword(ForgotPasswordModels models)
        {
            ResponseModels result = new ResponseModels();

            result.Response = MethodResponse.Success;
            DataSet ds = new DataSet();

            SqlParameter[] pr = new SqlParameter[]
            {
                new SqlParameter("@Email", models.Email),
                new SqlParameter("@Password", models.Password),
                new SqlParameter("@Mode", "ForgotPassword")
            };
            ds = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStr(), CommandType.StoredProcedure, "sp_Login", pr);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                result.Email     = ds.Tables[0].Rows[0]["Email"].ToString();
                result.UserID    = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString());
                result.FirstName = ds.Tables[0].Rows[0]["StudentFirstName"].ToString();
                result.LastName  = ds.Tables[0].Rows[0]["StudentLastName"].ToString();
                result.ORG_ID    = Convert.ToInt32(ds.Tables[0].Rows[0]["ORGID"].ToString());
                result.Response  = MethodResponse.Success;
            }
            else
            {
                result.Response = MethodResponse.Invalid_Email_And_Password;
            }
            return(result);
        }
 public ActionResult ForgotPassword(ForgotPasswordModels models)
 {
     if (ModelState.IsValid)
     {
         clsLoginBL.ForgotPassword(models);
     }
     return(View());
 }
Example #4
0
        public ActionResult ForgotPasswordEmail(ForgotPasswordModels model)
        {
            User user = _accountService.GetUserByEmail(model.EmailValidation.Email);

            if (user != null)
            {
                ForgotPasswordHintModels hintModel = new ForgotPasswordHintModels();
                model.HintAnswerValidation              = hintModel;
                model.HintAnswerValidation.Id           = user.Id;
                model.HintAnswerValidation.HintQuestion = user.HintQuestion;
            }
            else
            {
                return(RedirectToAction("ForgotPassword", new { Message = "Email address not Found. Please try again with the valid email address." }));
            }


            return(View("ForgotPassword", model));
        }
Example #5
0
        public ActionResult ForgotPasswordHint(ForgotPasswordModels model)
        {
            User user = _accountService.ValidateHintAnswer(model.HintAnswerValidation.Id, model.HintAnswerValidation.HintAnswer);

            if (user != null)
            {
                bool changePasswordSucceeded = _accountService.ChangePassword(user.Id, model.HintAnswerValidation.NewPassword);
                if (changePasswordSucceeded)
                {
                    return(RedirectToAction("Login", "Account", new { Message = "Password updated. Please login with your new password..." }));
                }
                else
                {
                    return(RedirectToAction("ForgotPassword", new { Message = "Something went wrong. Please try again. " }));
                }
            }
            else
            {
                return(RedirectToAction("ForgotPassword", new { Message = "Something went wrong with the answer. Please try again. " }));
            }

            return(View("ForgotPassword", model));
        }
        public ActionResult ForgotPassword()
        {
            ForgotPasswordModels model = new ForgotPasswordModels();

            return(View(model));
        }
Example #7
0
 public static ResponseModels ForgotPassword(ForgotPasswordModels models)
 {
     return(clsLoginDL.ForgotPassword(models));
 }