Password Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogesvamp
    New Member
    • Apr 2009
    • 3

    Password Problem

    I am new to javascript..

    i have a made a form simply containing username textfield, the password text field and the submit button..

    when the user click on the submit button i want to them to go to a certain url if the password is correct ...

    i want the password to be stored in a separate javascript file ....is that possible

    plz can anybody teach me how to do it ...
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I strongly recommend doing the password check on the server. Although there is a possibility to use md5 and sha1 hash functions* (link).

    * never store the passwords in plain text, better store its hash value somewhere and compare it with the hashed return of the supposed to be password from the input.

    Comment

    • yogesvamp
      New Member
      • Apr 2009
      • 3

      #3
      I just don't know how to do that ..could you provide me the code plz

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Javascript or server side?

        Comment

        • yogesvamp
          New Member
          • Apr 2009
          • 3

          #5
          server side .. if its not much trouble for you

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            basicly it runs like that (I'm using PHP here)
            Code:
            if ( hash(HASH_TYPE, $_POST['password']) == STORED_PW_HASH )
              // I use 'ripemd256', at least use 'sha256'
              // HASH_TYPE & STORED_PW_HASH may as well be class constants
            {
                // do allowed things like setting $_SESSION etc.
            }

            Comment

            Working...