public ActionResult ChangePassword(FormCollection collection) { if (collection["UserEmail"] == null || collection["UserOldPassword"] == null || collection["UserNewPassword"] == null || collection["UserNewPasswordConfirm"] == null) { return(RedirectToAction("ChangePassword", "User")); } var userEmail = (collection["UserEmail"] != null)?collection["UserEmail"].ToString(): null; var UserOldPassword = (collection["UserOldPassword"] != null)? collection["UserOldPassword"].ToString(): null; var UserNewPassword = (collection["UserNewPassword"] != null)? collection["UserNewPassword"].ToString(): null; var UserNewPasswordConfirm = (collection["UserNewPasswordConfirm"] != null)? collection["UserNewPasswordConfirm"].ToString(): null; var user = KitBL.Instance.Users.GetByEmailPass(userEmail, UserOldPassword); if (user == null) { user = KitBL.Instance.Users.GetByEmailPass(userEmail, UserOldPassword.Replace("NewPassword", string.Empty)); } if (user != null && UserNewPassword == UserNewPasswordConfirm) { user.PasswordHashed = UserNewPassword; KitBL.Instance.Users.Update(user); SMTP.sendEmail("*****@*****.**", user.Email, "Your password was changed!", "Thank you for using knowledgeshare.ro . Your password was changed at your request, if you lose it you can generate a new one anytime."); return(RedirectToAction("Profile", "User")); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult LostPassword(FormCollection collection) { if (collection["recoverUserEmail"] == null) { return(RedirectToAction("LostPassword", "User")); } var userEmail = collection["recoverUserEmail"].ToString(); var user = KitBL.Instance.Users.GetByEmail(userEmail); if (user != null && user.Email != "" && user.Email != null) { var newPassword = user.PasswordHashed + "NewPassword"; SMTP.sendEmail("*****@*****.**", user.Email, "Password change request!", "Please change your password, visit www.Knowledgeshare.ro/User/ChangePassword . Your temporary password is:" + newPassword); } return(RedirectToAction("Profile", "User")); }
private void buttonSend_Click(object sender, EventArgs e) { if (this.textBoxName.Text.Length == 0) { MessageBoxExtend.messageWarning("企业名称不能为空."); return; } if (this.textBoxPeople.Text.Length == 0) { MessageBoxExtend.messageWarning("联系人不能为空."); return; } if (this.textBoxPhone.Text.Length == 0) { MessageBoxExtend.messageWarning("联系电话不能为空."); return; } if (this.textBoxContent.Text.Length == 0) { MessageBoxExtend.messageWarning("问题描述不能为空."); return; } string emailTitle = this.textBoxName.Text + "#" + this.textBoxPeople.Text + "#" + this.textBoxPhone.Text; string emailContent = this.textBoxContent.Text; try { SMTP.sendEmail(emailTitle, emailContent); MessageBoxExtend.messageOK("信息反馈成功"); this.Close(); } catch (Exception exp) { MessageBoxExtend.messageError("信息发送失败!\n\n请确认电脑是否已连接到Internet,然后重新.\n如果依然无法发送请联系软件供应商.\n" + exp.ToString()); } }
public ActionResult Register(FormCollection collection) { UserBL user = new UserBL { Email = collection["registerUserEmail"], PasswordHashed = collection["registerUserPassword"], FirstName = collection["registerUserName"], LastName = "Guest", Flags = UserFlagsBL.Default, JoinDate = DateTime.Now, UserType = UserTypeBL.Member }; var userId = KitBL.Instance.Users.Insert(user); var success = AsyncUserLogin(user.Email, user.PasswordHashed); var emailTemplate = KitBL.Instance.EmailTemplate.GetByName("GeneralRegister"); SMTP.sendEmail("*****@*****.**", user.Email, emailTemplate.Subject, emailTemplate.Structure); return(RedirectToAction("Index", "Home")); }