Exemplo n.º 1
0
        public ActionResult ModifyPasswordIndex()
        {
            UIUserInfo uiUserInfo = null;

            if (!UILoginHelper.CheckUserLogin(HttpContext))
            {
                return(View(uiUserInfo));
            }

            var result = UserInfoBo.GetUserInfoByLoginNameOrEmail(UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext));

            if (result.IsSuccess)
            {
                var bizUserInfo = result.Target as BizUserInfo;
                if (bizUserInfo == null || bizUserInfo.UserInfoID == 0)
                {
                    return(View(uiUserInfo));
                }
                uiUserInfo                 = new UIUserInfo();
                uiUserInfo.UserEmail       = bizUserInfo.UserEmail;
                uiUserInfo.UserName        = bizUserInfo.UserName;
                uiUserInfo.LoginName       = bizUserInfo.UserLoginName;
                uiUserInfo.Phone           = bizUserInfo.UserPhone;
                uiUserInfo.LoginName       = bizUserInfo.UserLoginName;
                uiUserInfo.QQ              = bizUserInfo.UserQQ;
                uiUserInfo.UserInfoComment = bizUserInfo.UserInfoComment;
                uiUserInfo.UserImagURL     = bizUserInfo.UserImagURL;
            }
            return(View(uiUserInfo));
        }
Exemplo n.º 2
0
        public ActionResult SendRetrievePasswordEmail(string emailAccount)
        {
            BizResultInfo result = new BizResultInfo();

            if (string.IsNullOrEmpty(emailAccount))
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "邮箱地址不能为空。";
                return(Json(result));
            }

            result = UserInfoBo.GetUserInfoByLoginNameOrEmail(emailAccount);
            if (result.IsSuccess)
            {
                var retrievePasswordEmailContent = BizConfigurationInfo.LoadByKey(Conts.RetrievePasswordEmailContentKey).ConfigurationValue;
                var userInfo = result.Target as BizUserInfo;
                if (userInfo == null)
                {
                    result.IsSuccess    = false;
                    result.ErrorMessage = "找不到对象了...可能这就是命吧。";
                    return(Json(result));
                }

                string token = (userInfo.UserInfoID + userInfo.UserEmail + DateTime.Now).ConvertToCiphertext();
                var    retrievePasswordLog = new BizRetrievePasswordLog();
                retrievePasswordLog.CreateTime = DateTime.Now;
                retrievePasswordLog.LogStatus  = 0;
                retrievePasswordLog.Token      = token;
                retrievePasswordLog.UserInfoID = userInfo.UserInfoID;
                retrievePasswordLog.LastTime   = DateTime.Now;
                retrievePasswordLog.Save();


                EmailInfo emailInfo = new EmailInfo();
                emailInfo.Subject  = "WebBookmark找回密码";
                emailInfo.Body     = string.Format(retrievePasswordEmailContent, token, token);
                emailInfo.Receiver = emailAccount;
                emailInfo.Send();
            }
            result.IsSuccess = true;

            return(Json(result));
        }
Exemplo n.º 3
0
        public ActionResult CheckUserLoginName(string loginName)
        {
            var           cookieLoginName = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);
            BizResultInfo result          = UserInfoBo.GetUserInfoByLoginNameOrEmail(cookieLoginName);

            if (result.IsSuccess)
            {
                var userInfo = result.Target as BizUserInfo;
                if (!userInfo.UserLoginName.Equals(loginName))
                {
                    result = UserInfoBo.CheckUserEmailOrLoginName(loginName);
                }
                else
                {
                    result.IsSuccess      = true;
                    result.SuccessMessage = "邮箱是有效的哦,可以使用。";
                }
            }
            return(Json(result));
        }
Exemplo n.º 4
0
        public ActionResult SaveUserImag()
        {
            BizResultInfo result = UploadFileHelper.UploadFileToUserImg(Request);

            if (result.IsSuccess)
            {
                var loginEmail  = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);
                var res         = UserInfoBo.GetUserInfoByLoginNameOrEmail(loginEmail);
                var bizUserInfo = res.Target as BizUserInfo;
                var path        = Server.MapPath(bizUserInfo.UserImagURL);
                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
                bizUserInfo.UserImagURL = result.ResultID;
                bizUserInfo.Save();
                result.SuccessMessage = "上传成功!";
            }
            return(Json(result));
        }
Exemplo n.º 5
0
        public ActionResult CheckUserEmail(string email)
        {
            var cookieLoginName = UILoginHelper.GetUIUserLoginNameOrEmail(HttpContext);

            if (!cookieLoginName.Contains('@'))
            {
                var userInfo = UserInfoBo.GetUserInfoByLoginNameOrEmail(cookieLoginName).Target as BizUserInfo;
                cookieLoginName = userInfo.UserEmail;
            }

            BizResultInfo result = new BizResultInfo();

            if (cookieLoginName.Equals(email))
            {
                result.IsSuccess      = true;
                result.SuccessMessage = "邮箱是有效的哦,可以使用。";
            }
            else
            {
                result = UserInfoBo.CheckUserEmailOrLoginName(email);
            }
            return(Json(result));
        }
Exemplo n.º 6
0
        private BizResultInfo SaveUserToDB(String loginEmail, UIUserInfo uiUserInfo)
        {
            var result = UserInfoBo.GetUserInfoByLoginNameOrEmail(loginEmail);

            if (result.IsSuccess)
            {
                var userInfo = result.Target as BizUserInfo;
                userInfo.UserEmail       = uiUserInfo.UserEmail;
                userInfo.UserInfoComment = uiUserInfo.UserInfoComment;
                userInfo.UserName        = uiUserInfo.UserName;
                userInfo.UserQQ          = uiUserInfo.QQ;
                userInfo.UserPhone       = uiUserInfo.Phone;
                userInfo.UserLoginName   = uiUserInfo.LoginName;
                userInfo.Save();
                result.IsSuccess      = true;
                result.SuccessMessage = "保存成功了耶,你可以去别的地方玩了。";
            }
            else
            {
                result.IsSuccess    = false;
                result.ErrorMessage = "没找到登陆信息呀呀呀!";
            }
            return(result);
        }