public ActionResult RegisterUser(UIUserInfo uiUserInfo) { var bizUserInfo = new BizUserInfo(); bizUserInfo.UserEmail = uiUserInfo.UserEmail; bizUserInfo.UserLoginName = uiUserInfo.UserEmail; bizUserInfo.UserName = uiUserInfo.UserName; bizUserInfo.UserPassword = uiUserInfo.Password; bizUserInfo.UserPhone = uiUserInfo.Phone; bizUserInfo.UserQQ = uiUserInfo.QQ; bizUserInfo.UserInfoComment = uiUserInfo.UserInfoComment; string token = (uiUserInfo.UserEmail + uiUserInfo.UserName).ConvertToCiphertext(); bizUserInfo.ActivateAccountToken = token; bizUserInfo.AccountStatus = 0; var result = UserInfoBo.RegisterUser(bizUserInfo); if (result.IsSuccess) { var activateAccountEmailContent = BizConfigurationInfo.LoadByKey(Conts.ActivateAccountEmailContentKey).ConfigurationValue; EmailInfo activateAccountEmail = new EmailInfo(); activateAccountEmail.Receiver = uiUserInfo.UserEmail; activateAccountEmail.Subject = "激活WebBookmark账号"; activateAccountEmail.Body = string.Format(activateAccountEmailContent, token, token); activateAccountEmail.Send(); } return(Json(result)); }
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)); }