protected void Page_Load(object sender, EventArgs e) { string username = this.Request.QueryString["username"]; //if the username and hash are correct, send a generated password Incremental.Kick.Dal.User user = UserBR.GetUserByUsername(username); int hash = int.Parse(this.Request.QueryString["hash"]); int expectedHash = user.LastActiveOn.Ticks.GetHashCode(); if (hash != expectedHash) { throw new ApplicationException("Invalid hash for ResetPassword, [" + expectedHash.ToString() + "] was expected"); } UserBR.ResetPassword(user.UserID, this.HostProfile); }
protected void ResetPassword_Click(object sender, EventArgs e) { //send an email to the user try { Incremental.Kick.Dal.User userTable = UserBR.GetUserByEmail(this.Email.Text.Trim()); //send a mail to the user with a link to change the password UserBR.SendPasswordResetEmail(userTable.UserID, this.KickPage.HostProfile); ConfirmationMessageLabel.Text = "An email has been sent to " + this.Email.Text + ", please check your mail."; } catch (Exception) { ErrorMessageLabel.Text = "Sorry, we have no account with that email address"; } }