What method do you use? php with a database? cgi against a protected file? Clickpass.com like HN.
Or did you roll your own?
1–10 of 58 posts
What method do you use? php with a database? cgi against a protected file? Clickpass.com like HN.
Or did you roll your own?
On registration:
- Ask for username and password (do form validation, ie passwords match, xss clean, etc). toLowercase() the login.
- Create a hash of some type for the password. This becomes used in the database, and again on login. If you're not worried about security, md5 your password, store it in the db. Otherwise, look up a salt hash.
- I typically log the user out and then require them to log in and create a session after they registered.
On login
- Ask for username and password, toLowercase() the login when checking
- Run the same md5 or salt hash against the password, check if the # of rows in the database is > 0, if it is, log the person in and give them a session with a value of "is_logged_in" to true or something similar. Also pull the database user_id or e-mail and use that to remember which user you're dealing with.
- If the # of rows found in database is == 0 (where the login and pass equal those from your post variables), the login failed
I have my own code I use on my projects. It uses secure SHA 256 hashing for the passwords. The code handles registration, login, logout, and forgot password flows.
This is the best strategy for us because it allows us to offer a wide array of services running through our accounts, using out of the box software..
We can tie the forums into LDAP without writing our own, as well as our internal Jabber server, etc.
Once login has completed, we give the user a 128-bit sessionID, which we use for all further communication, until their session expires.
I have always created my own. Although I've been doing PHP, I'm currently using RoR and it has a plugin that handles all of this. PHP with a database is very easy, especially if you use CodeIgniter, there are form validation helper classes. On registration: - Ask for username and password (do form validation, ie passwords match, xss clean, etc). toLowercase() the login. - Create a hash of some type for the password.…
http://www.matasano.com/log/958/enough-with-the-rainbow-tabl...
It seems pretty straightforward (hash pass, place on server, and check against), but I need an easy way to compute an SHA hash in-browser, so the server doesn't have to receive the pass in plaintext.
Anyone know of a way to do it with Struts/JSP, or even JS if its not too slow?