Send random password to approved user
I wonder how I can accomplish the following task:
I have a registration page built in SA where a user apply for membership to my site. They just enter their personal information like name, address, email etc. These values are written into my db. I also have a accesslevel column and new users gets a applicant status when they register that wont let them login until I change that value in db to approved user. When they register they don't enter a desired password so that column remains blank in db. Now from my admin pages built with DA I have the userupdate page where I can change the registered users personal information if needed and also update the users status to approved user via a accesslevels menufield. All this works but at the time I change the users accesslevel to approved and submitting the changes (updating the form) I would like to have an email sent to the user with login information to my site containing their ID/email and an autogenerated password (random password) which is also inserted in db at the time I submit the change. I would like this password to be inserted encrypted with SHA1 in db. Of course the user should recieve the email showing that password none-encrypted. When the user is successfully logged in with his sent credentials he/she should be able to change that autogenerated password in the userupdate page (SA built page) to whatever he/she chooses according to password rules of course and when submitting the change the password should be updated in db with SHA1 encryption. I hope my explanation on what I'd like to accomplish is clear? I need some input in how to accomplish this!
Thanks in advance!