示例#1
0
        public ActionResult resetadpassword(User user, FormCollection collection)
        {
            Site Site = GetSite(user.SiteID);

            string msg = string.Empty;

            if (user.ID > 0)
            {
                User objUser = _repository.FindByID(user.ID);
                objUser.PasswordSalt    = WBHelper.CreateSalt();
                objUser.PasswordHash    = WBHelper.CreatePasswordHash(collection["txtPassword"], objUser.PasswordSalt);
                objUser.ConfirmPassword = objUser.PasswordHash;
                _repository.Update(objUser);
                _unitOfWork.Commit();


                msg = "<div class='normsg'>Password changed successfully. <a href='" + Request.Url.Scheme + "://" + Site.Alias + "/logon" + "'>Click here</a> to login.</div>";
            }
            else
            {
                msg = "<div class='normsg'>Error during Password change process. Please try again.</div>";
            }

            return(Json(new { d = msg }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult PasswordReset(User user, FormCollection collection)
        {
            Site Site       = GetSite(user.SiteID);
            bool ReturnCode = false;

            if (user.ID > 0)
            {
                User objUser = _repository.FindByID(user.ID);
                objUser.PasswordSalt    = WBHelper.CreateSalt();
                objUser.PasswordHash    = WBHelper.CreatePasswordHash(collection["txtPassword"], objUser.PasswordSalt);
                objUser.ConfirmPassword = objUser.PasswordHash;
                _repository.Update(objUser);
                _unitOfWork.Commit();
                ReturnCode = true;
            }
            string url = (USESSL ? "https" : "http") + "://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias) + "/staticpage/passwordresetresult?authcode=" + HttpUtility.UrlEncode(CryptorEngine.Encrypt(ReturnCode.ToString() + SettingConstants.Seprate + user.ID, true));

            return(Redirect301(url, (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias)));
        }
        public ActionResult resellersignup(User user)
        {
            Site   Site      = GetSite(user.SiteID);
            string AuthToken = "";

            if (ModelState.IsValid)
            {
                user.RecordStatusID = NeedApproveReseller ? (int)RecordStatus.INACTIVE : (int)RecordStatus.ACTIVE;
                user.PasswordSalt   = WBHelper.CreateSalt();
                user.PasswordHash   = WBHelper.CreatePasswordHash(user.PasswordHash, user.PasswordSalt);

                int result = _service.SaveReseller(user, Site.ID, WBHelper.CurrentLangID(), SiteCacher.SiteSMTPDetail().ID, WBHelper.SiteAdminEmail(Site));
                if (result.Equals(1))
                {
                    if (!NeedApproveReseller)
                    {
                        AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "true", true));
                    }
                    else
                    {
                        AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("true" + SettingConstants.Seprate + user.Email + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "false", false));
                    }
                }
                else if (result.Equals(-1))
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-1" + SettingConstants.Seprate + "false", true));
                }
                else
                {
                    AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-2" + SettingConstants.Seprate + "false", true));
                }
            }
            else
            {
                AuthToken = HttpUtility.UrlEncode(CryptorEngine.Encrypt("false" + SettingConstants.Seprate + "NA" + SettingConstants.Seprate + "-3" + SettingConstants.Seprate + "false", true));
            }

            // If we got this far, something failed, redisplay form
            string url = "http://" + (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias) + "/staticpage/resellersignupresult?authtoken=" + AuthToken;

            return(Redirect301(url, (string.IsNullOrEmpty(Site.Alias) ? Site.CName : Site.Alias)));
        }