예제 #1
0
 public ActionResult ResetPassword(string EncryptUserClientId, ClientChangePassword ObjModel)
 {
     if (ModelState.IsValidField("NewPassword") && ModelState.IsValidField("ConfirmPassword"))
     {
         EncryptUserClientId = EncryptUserClientId.Replace("$", "+");
         EncryptUserClientId = EncryptUserClientId.Replace("/", "!");
         Encrypt64 encrypt      = new Encrypt64();
         string    UserClientId = encrypt.Decrypt(EncryptUserClientId, ConfigurationManager.AppSettings["SecureKey"].ToString());
         ObjModel.UserClientId = Convert.ToInt32(UserClientId);
         ClientLoginHelper clientLoginHelper = new ClientLoginHelper();
         ClientLogOnModel  clientLogOnModel  = new ClientLogOnModel();
         clientLogOnModel = clientLoginHelper.GetById(ObjModel.UserClientId);
         int Result = clientLoginHelper.ForgotChangePassword(ObjModel);
         if (Result == 0)
         {
             TempData["CommonMessage"] = AppLogic.setMessage(0, "Password changed sucessfully");
             return(Redirect(Url.Content("~/" + clientLogOnModel.StrataPortalLink + "/Login")));
         }
         else
         {
             TempData["CommonMessage"] = AppLogic.setMessage(1, "Please check password you have entered and Try again");
             return(View());
         }
     }
     else
     {
         return(View());
     }
 }
예제 #2
0
        // GET: VendorLogin
        public ActionResult Login()
        {
            VendorLoginModel _model = new VendorLoginModel();

            if (Request.Cookies["VendorCookie"] != null)
            {
                var authCookie = Request.Cookies["VendorCookie"];
                _model.EmailId    = enc.Decrypt(authCookie.Values["VendorEmail"]);
                _model.Password   = enc.Decrypt(authCookie.Values["VendorPassword"]);
                _model.RememberMe = true;
            }
            else
            {
                _model.RememberMe = false;
            }
            return(View(_model));
        }
예제 #3
0
        public ActionResult Login(VendorLoginModel _model)
        {
            var vendor = VendorHelper.Instance.GetVendorByEmail(_model.EmailId);

            if (vendor == null)
            {
                ModelState.AddModelError("EmailId", "Invalid Email Id");
            }
            else if (vendor.AdminApproval == 0)
            {
                TempData["Message"] = AppLogic.setFrontendMessage(1, "Your account is pending for approval. Please contact strataboard admin!");
            }
            else if (vendor.AdminApproval == 2)
            {
                TempData["Message"] = AppLogic.setFrontendMessage(1, "Your account has been rejected. Please contact strataboard admin!");
            }
            else if (vendor.Status != 1)
            {
                TempData["Message"] = AppLogic.setFrontendMessage(1, "Your account is deactive. Please contact strataboard admin!");
            }
            else
            {
                Encrypt64 enc   = new Encrypt64();
                var       pass  = enc.Encrypt(_model.Password);
                var       pass2 = enc.Decrypt(vendor.Password);
                if (vendor.Password == pass)
                {
                    Session["VendorId"]             = vendor.VendorId;
                    Session["VendorEmailId"]        = vendor.EmailId;
                    Session["VendorName"]           = vendor.VendorName;
                    Session["VendorMobile"]         = vendor.MobileNumber;
                    Session["VendorProfilePicture"] = vendor.ImageFile;
                    Session["VendorCreatedOn"]      = vendor.CreatedOn;

                    HttpCookie cookie = new HttpCookie("VendorCookie");

                    if (_model.RememberMe)
                    {
                        cookie.Values.Add("VendorEmail", enc.Encrypt(vendor.EmailId));
                        cookie.Values.Add("VendorPassword", vendor.Password);
                        cookie.Expires = DateTime.Now.AddDays(365);
                    }
                    else
                    {
                        cookie.Expires = DateTime.Now.AddDays(-1d);
                    }
                    Response.Cookies.Add(cookie);
                    return(RedirectToAction("Dashboard"));
                }
                else
                {
                    ModelState.AddModelError("Password", "Invalid Password");
                }
            }
            return(View(_model));
        }
예제 #4
0
        public UserModel GetUserById(UserModel objUserModel)
        {
            try
            {
                SqlParameter   prmFlag   = SqlHelper.CreateParameter("@Flag", objUserModel.Flag);
                SqlParameter   prmUserId = SqlHelper.CreateParameter("@UserId", objUserModel.UserId);
                SqlParameter[] allParams = { prmFlag, prmUserId };
                SqlDataReader  drReader  = SqlHelper.ExecuteReader(_conString, CommandType.StoredProcedure, "usp_GetUser", allParams);
                if (drReader.HasRows)
                {
                    if (drReader.Read())
                    {
                        Encrypt64 encryptPass = new Encrypt64();
                        objUserModel.UserId          = Convert.ToInt64(drReader["userId"].ToString());
                        objUserModel.FirstName       = drReader["firstName"].ToString();
                        objUserModel.LastName        = drReader["lastName"].ToString();
                        objUserModel.LoginId         = drReader["loginId"].ToString();
                        objUserModel.EmailId         = drReader["EmailId"].ToString();
                        objUserModel.RoleId          = Convert.ToInt32(drReader["roleId"].ToString());
                        objUserModel.Status          = Convert.ToInt32(drReader["Status"].ToString());
                        objUserModel.Password        = encryptPass.Decrypt(drReader["password"].ToString(), ConfigurationManager.AppSettings["SecureKey"].ToString());
                        objUserModel.ConfirmPassword = objUserModel.Password;
                        objUserModel.Gender          = drReader["gender"].ToString();
                        objUserModel.DOBMMDDYYYY     = drReader["DOBMMDDYYYY"].ToString();
                    }
                    else
                    {
                        drReader.Close();
                    }
                }
                drReader.Close();

                return(objUserModel);
            }
            catch
            {
                throw;
            }
        }