コード例 #1
0
ファイル: CPW.aspx.cs プロジェクト: bfair370/ivote-teama
    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.";
        }
    }
コード例 #2
0
    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 && oldPW.Text != newPW.Text)
            {
                bool ChangePasswordSuccess = logger.ChangePassword(HttpContext.Current.User.Identity.Name.ToString(), oldPW.Text, newPW.Text);
                FailurePanel.Visible = false;
                SuccessPanel.Visible = true;
            }
            else
            {
                FailurePanel.Visible = true;
                SuccessPanel.Visible = false;
            }

        }
    }