Beispiel #1
0
 private void ChangePasswordQAHelper(MembershipUser user, string pw, string newQ, string newA)
 {
     try
     {
         user.ChangePasswordQuestionAndAnswer(pw, newQ, newA);
         Assert.Fail("This should not work.");
     }
     catch (ArgumentNullException ane)
     {
         Assert.AreEqual("password", ane.ParamName);
     }
     catch (ArgumentException)
     {
         Assert.IsNotNull(pw);
     }
 }
        /// <summary>
        /// this method is used to change the user Security question and answer //Developed by swaraj on 19 feb 2010
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lbtnSecurity_Click(object sender, EventArgs e)
        {
            try
            {
                objMembershipUser = Membership.GetUser(User.Identity.Name);

                bool Result = objMembershipUser.ChangePasswordQuestionAndAnswer(txtPwd.Text.ToString(), txtSecurityQue.Text.ToString(), txtSecurityAns.Text.ToString());
                if (Result == true)
                {
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                    lblMsg.Text = "Security Question and Answer has been changed successfully";
                    txtPwd.Text = "";
                    txtSecurityAns.Text = "";
                    txtSecurityQue.Text = "";
                }
                else
                {
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                    lblMsg.Text = "Please verify the password";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
 /// <summary>
 /// Change security question and answer
 /// </summary>
 /// <param name="user">Membership user</param>
 /// <param name="password">current password</param>
 /// <param name="newQuestion">new question</param>
 /// <param name="newAnswer">new answer</param>
 /// <returns>Return true if security question changed</returns>
 public bool ChangeSecurityQuestionAndAnswer(MembershipUser user, string password, string newQuestion,
                                             string newAnswer)
 {
     return user.ChangePasswordQuestionAndAnswer(password, newQuestion, newAnswer);
 }
Beispiel #4
0
 public bool ChangePasswordQuestionAndAnswer(string newPassword, string passwordQuestion, string passwordQuestionAnswer)
 {
     return(membershipUser.ChangePasswordQuestionAndAnswer(newPassword, passwordQuestion, passwordQuestionAnswer));
 }