protected void submission(object sender, EventArgs e) { if (Page.IsValid) { //check old password iVoteLoginProvider logger = new iVoteLoginProvider(); databaseLogic dblogic = new databaseLogic(); bool pw_correct = logger.ValidateUser(HttpContext.Current.User.Identity.Name.ToString(), oldPW.Text); if (pw_correct) { lblConfirm.Text = "Your password has been successfully changed."; string e_pw = logger.encrypt(newPW.Text); dblogic.updatePassword2(HttpContext.Current.User.Identity.Name.ToString(), e_pw); } else lblConfirm.Text = "Old password is incorrect."; //decrypt password fromt his //lblConfirm.Text = "Form in progress."; //change form state lblForm.Visible = false; //lblConfirm.Text = "Thank you. Your password has been changed."; } }
protected void ButtonSave_Clicked(object sender, EventArgs e) { if (Page.IsValid) { iVoteLoginProvider encryptionHelper = new iVoteLoginProvider(); dbLogic.updatePassword(HiddenFieldPassword.Value, encryptionHelper.encrypt(TextBoxPassword.Text)); //inserts new encrypted password dbLogic.deleteCode(fullCode); //deletes code row from database //Make form invisible lblForm.Visible = false; //display confirmation message lblConfirm.Visible = true; } }