protected void btnSaveNewPassword_Click(object sender, EventArgs e) { int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(tbPassword.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { lblErrorPasswords.Text = PasswordValidate.PasswordFailMessage + "."; tbPassword.Text = ""; tbPasswordConfirm.Text = ""; divErrorPasswords.Visible = true; tbPassword.Focus(); } else { int intUserID = 0; int intUserSecurityID = 0; if ((int.TryParse(Session["UserID"].ToString(), out intUserID)) && (int.TryParse(hidUserSecurityID.Value, out intUserSecurityID))) { Classes.cLogin UpdateSecurity = new Classes.cLogin(); UpdateSecurity.UpdateQAandPassword(intUserSecurityID, intUserID, hidQuestion1.Value, hidUpdate1.Value, hidQuestion2.Value, hidUpdate2.Value, hidQuestion3.Value, hidUpdate3.Value, hidAnswer1.Value, hidUpdate1.Value, hidAnswer2.Value, hidUpdate2.Value, hidAnswer3.Value, hidUpdate3.Value, tbPassword.Text); mvInfoRequest.SetActiveView(vwFinalStep); } } }
protected void btnSubmitPasswordChange_Click(object sender, EventArgs e) { int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(txtNewPassword.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { if (lblPasswordErrors.Text != "") { lblPasswordErrors.Text = lblPasswordErrors.Text + "<p></p>" + PasswordValidate.PasswordFailMessage + "."; } else { lblPasswordErrors.Text = PasswordValidate.PasswordFailMessage + "."; } txtNewPassword.Text = ""; txtNewPasswordRetype.Text = ""; lblPasswordErrors.Visible = true; txtNewPassword.Focus(); } else { int UserID = ((int)Session["UserID"]); int iTemp; int intUserSecurityID = 0; if (int.TryParse(UserSecurityID.Text, out iTemp)) { intUserSecurityID = iTemp; } Classes.cLogin UpdateSecurity = new Classes.cLogin(); UpdateSecurity.UpdateQAandPassword(intUserSecurityID, UserID, Q1.Text, Q1Update.Text, Q2.Text, Q2Update.Text, Q3.Text, Q3Update.Text, A1.Text, A1Update.Text, A2.Text, A2Update.Text, A3.Text, A3Update.Text, txtNewPassword.Text); pnlSetPasswords.Visible = false; pnlFinalStep.Visible = true; } }
protected void btnSignUp_Click(object sender, EventArgs e) { if (Session["AttemptedPassword"] == null) { txtPasswordNew.Text = ""; } else { txtPasswordNew.Text = Session["AttemptedPassword"].ToString(); txtPasswordNew.Attributes.Add("value", txtPasswordNew.Text); } if (Session["AttemptedPasswordRetype"] == null) { txtPasswordNewRetype.Text = ""; } else { txtPasswordNewRetype.Text = Session["AttemptedPasswordRetype"].ToString(); txtPasswordNewRetype.Attributes.Add("value", txtPasswordNewRetype.Text); } if (Page.IsValid) { lblSignUpErrors.Text = ""; // 1 - No duplicate usernames allowed Classes.cLogin Login = new Classes.cLogin(); Login.CheckForExistingUsername(txtNewUsername.Text); if (Login.MemberID != 0) // UserID is taken { lblSignUpErrors.Text = "This username is already in use. Please select a different one."; } // 2 - Password must meet parameter standards int ValidPassword; Classes.cLogin PasswordValidate = new Classes.cLogin(); PasswordValidate.ValidateNewPassword(txtPasswordNew.Text); ValidPassword = PasswordValidate.PasswordValidation; if (ValidPassword == 0) { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>" + PasswordValidate.PasswordFailMessage + "."; } else { lblSignUpErrors.Text = PasswordValidate.PasswordFailMessage + "."; } } // 3 - Both passwords must be the same if (txtPasswordNew.Text != txtPasswordNewRetype.Text) //set an error message { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>Passwords don't match. Please re-enter."; } else { lblSignUpErrors.Text = "Passwords don't match. Please re-enter."; } txtPasswordNew.Text = ""; txtPasswordNewRetype.Text = ""; } // 4 - New request - If the email address is already on file, warn them and suggest they go to the Forgot Username / Password section Classes.cLogin ExistingEmailAddress = new Classes.cLogin(); ExistingEmailAddress.GetUsernameByEmail(txtEmail.Text); if (ExistingEmailAddress.Username != "") { if (lblSignUpErrors.Text != "") { lblSignUpErrors.Text = lblSignUpErrors.Text + "<p></p>This email address is already associated with an account. If you've forgotten your username or password, please use the link above."; } else { lblSignUpErrors.Text = "This email address is already associated with an account. If you've forgotten your username or password, please use the link above."; } } // If there were errors, display them and return to form if (lblSignUpErrors.Text != "") { lblSignUpErrors.Visible = true; txtNewUsername.Focus(); } else { // Everything is ok. Create the record. If successful, go to the member demographics screen. Classes.cUser NewUser = new Classes.cUser(txtNewUsername.Text, txtPasswordNew.Text); NewUser.FirstName = txtFirstName.Text; NewUser.LastName = txtLastName.Text; NewUser.LoginPassword = txtPasswordNew.Text; NewUser.LoginEmail = txtEmail.Text; NewUser.LoginName = txtNewUsername.Text; NewUser.Save(); Classes.cLogin Activation = new Classes.cLogin(); Activation.Load(txtNewUsername.Text, txtPasswordNew.Text); string ActivationKey = ""; ActivationKey = Activation.SecurityResetCode; GenerateWelcomeEmail(txtFirstName.Text, txtLastName.Text, txtNewUsername.Text, txtEmail.Text, ActivationKey); Response.Write("<script>"); Response.Write("window.open('NewUserLoginDirections.aspx','_blank')"); Response.Write("</script>"); // TODO-Rick-0e Account for versioning of 'terms of use' and keeping track of date/time and which version user agreed to } } else { // TODO-Rick-3 On create user if something totally unexpected is wrong put up a message } }
protected void btnSave_Click(object sender, EventArgs e) { if (!txtPassword.Text.Equals(txtPassword2.Text)) { lblError.Text = "Passwords do not match"; return; } //Validate password if (!string.IsNullOrWhiteSpace(txtPassword.Text)) { UserLoggedIn.ValidateNewPassword(txtPassword.Text); if (UserLoggedIn.PasswordValidation == 0) { lblError.Text = UserLoggedIn.PasswordFailMessage; return; } } if (string.IsNullOrWhiteSpace(txtSecurityQuestion1.Text)) { lblErrorQuestions.Text = "Please enter security question"; txtSecurityQuestion1.Focus(); return; } if (string.IsNullOrWhiteSpace(txtSecurityAnswer1.Text)) { lblErrorQuestions.Text = "Please enter security answer"; txtSecurityAnswer1.Focus(); return; } string strEnterAnswer = "Please enter answer to question"; string strEnterQuestion = "Please enter question to answer"; //If question entered and answer not entered if (!string.IsNullOrWhiteSpace(txtSecurityQuestion2.Text) && string.IsNullOrWhiteSpace(txtSecurityAnswer2.Text)) { lblErrorQuestion2.Text = strEnterAnswer; lblErrorQuestion2.Focus(); return; } if (!string.IsNullOrWhiteSpace(txtSecurityQuestion3.Text) && string.IsNullOrWhiteSpace(txtSecurityAnswer3.Text)) { lblErrorQuestion3.Text = strEnterAnswer; lblErrorQuestion3.Focus(); return; } //If answer entered and question not entered if (string.IsNullOrWhiteSpace(txtSecurityQuestion2.Text) && !string.IsNullOrWhiteSpace(txtSecurityAnswer2.Text)) { lblErrorQuestion2.Text = strEnterQuestion; lblErrorQuestion2.Focus(); return; } if (string.IsNullOrWhiteSpace(txtSecurityQuestion3.Text) && !string.IsNullOrWhiteSpace(txtSecurityAnswer3.Text)) { lblErrorQuestion3.Text = strEnterQuestion; lblErrorQuestion3.Focus(); return; } //Make sure that questions and answers do not repeat UserLoggedIn.UpdateQAandPassword( UserLoggedIn.UserSecurityID, uID, txtSecurityQuestion1.Text, "1", txtSecurityQuestion2.Text, "1", txtSecurityQuestion3.Text, "1", txtSecurityAnswer1.Text, "1", txtSecurityAnswer2.Text, "1", txtSecurityAnswer3.Text, "1", string.IsNullOrWhiteSpace(txtPassword.Text) ? UserLoggedIn.Password : txtPassword.Text); lblError.Text = "Changes saved successfully."; }