Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Griffiths 370 posts 1021 karma points
    Feb 19, 2014 @ 12:05
    Paul Griffiths
    0

    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;
    
                }
    
            }
    

    Thanks

    Paul

  • Mike 23 posts 86 karma points
    Feb 19, 2014 @ 14:09
    Mike
    0

    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.

  • Paul Griffiths 370 posts 1021 karma points
    Feb 19, 2014 @ 14:16
    Paul Griffiths
    0

    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

  • Mike 23 posts 86 karma points
    Feb 19, 2014 @ 18:36
    Mike
    0

    Cool, glad I can help! Let us know how it goes and if it solves your problem.

     

Please Sign in or register to post replies

Write your reply to:

Draft