Example #1
0
        public ActionResult ForgotPassword(ResetForgotPassword model)
        {
            BALCommon obj = new BALCommon(ConStr);

            try
            {
                string OTP = obj.getUserProfile(model.UserName).OTP;
                if (!string.IsNullOrEmpty(OTP) && model.OTP == OTP)
                {
                    string sResetToken = WebSecurity.GeneratePasswordResetToken(model.UserName, 30000);
                    if (WebSecurity.ResetPassword(sResetToken, model.NewPassword))
                    {
                        TempData[Constants.MessageInfo.SUCCESS] = "Password has been updated successfully.";
                    }
                    else
                    {
                        TempData[Constants.MessageInfo.ERROR] = "Password could not updated.";
                    }
                }
                else
                {
                    TempData[Constants.MessageInfo.ERROR] = "Incorrect OTP.";
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
            }
            return(RedirectToAction("Login"));
        }
Example #2
0
        public ActionResult ResetPassword()
        {
            BALCommon           CSvc     = new BALCommon(ConStr);
            UserMasters         _umaster = CSvc.GetByUserId(WebSecurity.CurrentUserId);
            ResetForgotPassword obj      = new ResetForgotPassword
            {
                UserId   = WebSecurity.CurrentUserId,
                UserName = WebSecurity.CurrentUserName,
                Name     = _umaster.FISRTNAME,
                Lastname = _umaster.LASTNAME,
                IMAGE    = _umaster.IMAGE,
                Mobile   = _umaster.Mobile,
                EmailId  = _umaster.EMAILID
            };

            return(View(obj));
        }
Example #3
0
        public ActionResult ForgottenPasswordReset(ResetForgotPassword ForgottenPasswordResetModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(ForgottenPasswordResetModel));
            }

            int?UserID  = _UserRepo.UserGuidToID(ForgottenPasswordResetModel.UserID);
            var Results = _UserService.ResetPasswordFromToken(UserID.Value, ForgottenPasswordResetModel.Token, ForgottenPasswordResetModel.Password);

            if (Results.Succeeded)
            {
                return(View("ForgottenPasswordResetSuccessful"));
            }
            else
            {
                return(View("ForgottenPasswordResetFailure"));
            }
        }
Example #4
0
        public ActionResult ResetPassword(ResetForgotPassword model, FormCollection collection)
        {
            string             sResetToken = WebSecurity.GeneratePasswordResetToken(model.UserName, 30000);
            HttpPostedFileBase _profilepic = Request.Files["employeephotoimge"];
            string             folderpath  = Constants.USERPICK;
            BALCommon          CSvc        = new BALCommon(ConStr);
            UserMasters        _um         = CSvc.GetByUserId(WebSecurity.CurrentUserId);

            if (_profilepic.ContentLength > 0)
            {
                string guidstring = Guid.NewGuid().ToString();
                string _FileName  = Path.GetFileName(_profilepic.FileName);
                string filepath   = Path.Combine(Server.MapPath(folderpath) + guidstring + "_" + _FileName);
                string dbpath     = Path.Combine(folderpath + guidstring + "_" + _FileName);
                _profilepic.SaveAs(filepath);
                model.IMAGE = dbpath;
            }

            _um.UserId       = model.UserId;
            _um.USERNAME     = model.UserName;
            _um.FISRTNAME    = model.Name;
            _um.LASTNAME     = model.Lastname;
            _um.Mobile       = model.Mobile;
            _um.EMAILID      = model.EmailId;
            _um.MODIFIEDBY   = model.UserName;
            _um.MODIFIEDDATE = DateTime.Now;


            if (model.UserId == WebSecurity.CurrentUserId && WebSecurity.ResetPassword(sResetToken, model.NewPassword))
            {
                CSvc.AddUserprofile(_um, "UPD");
                TempData[Constants.MessageInfo.SUCCESS] = "Password reset successfully.";
            }
            else
            {
                TempData[Constants.MessageInfo.ERROR] = "Password could not reset.";
            }

            return(RedirectToAction("Index", "Home"));
        }
Example #5
0
        public ActionResult ForgotPassword()
        {
            ResetForgotPassword obj = new ResetForgotPassword();

            return(View(obj));
        }