well as far as my experieces are concern ppl encrypt password & store it inside the database(user login table) & there'd be an added option to the user to encrypt the password or not too....which i thnk is certainly a better pratice.
so it adds in one more boolean column in you login db table...:)
Hope that might help.. :)
REGARDS,
RaHuL
You can use one-way encryption, like MD5, to encrypt the values and store them encrypted in the database. This is not highly needed for the username, but it is recommended for the password.
Here is an useful snippet to get the MD5 hash for the given string: http://balusc.xs4all.nl/srv/dev-jep-use.html#GenerateMD5Hash
When an user registers, let it choose a non-existing username and ask for the password twice. If the username does not exist in the database and the entered passwords are equal, then hash the password (and eventually the username) and save it to the database.
When an user logs in, hash the entered password and compare it with the stored hash in the databse. If it is equal, then proceed with login.