How to check contents of a text box against umbraco password
Hi im allowing registered user to update there password from a user control but i want to do a test to see if there is any text in the textbox and then if there is i want to test to see if the current password that they have entered matches the one currently on record. I cant seem to validate this can someone help? my code is below.
Member member = Member.GetCurrentMember();
var curPass = member.Password.ToString();
if (txtNewPassword.Text != "")
{
if (txtCurrentPassword.Text != curPass)
{
lblCurPasswordError.Visible = true;
}
}
Essentially, you'll check that that the password text field is not empty (I'd use String.IsNullOrWhiteSpace()). and if that is true then use Membership.ValidateUser(username, password). If this isn't true then the password doesn't match.
How to check contents of a text box against umbraco password
Hi im allowing registered user to update there password from a user control but i want to do a test to see if there is any text in the textbox and then if there is i want to test to see if the current password that they have entered matches the one currently on record. I cant seem to validate this can someone help? my code is below.
Thanks
Paul
If I understand your question correctly, you're looking for the Membership.ValidateUser() method.
http://msdn.microsoft.com/en-us/library/system.web.security.membership.validateuser%28v=vs.110%29.aspx
Essentially, you'll check that that the password text field is not empty (I'd use String.IsNullOrWhiteSpace()). and if that is true then use Membership.ValidateUser(username, password). If this isn't true then the password doesn't match.
Hi Mike,
Thanks for your response!
Yeah that is definitely along the lines of what I am looking for I will give it a whirl and let you know mate
Paul
Cool, glad I can help! Let us know how it goes and if it solves your problem.
is working on a reply...