I want my users to activate their accounts before they are able to login. They are sent an email after registration containing an activation link, something like this:
http://www.blabla.com/[email protected]&token=Aisd23uNMAu53932asdDasd82AS
Of course, whenever someone logs in, I have to check wether or not that user has activated his/her account. I can think of 2 ways to solve this problem, either have an extra column in my 'users' table, which is set to empty whenever a user activates like so:
-----------------------------------------------
| id | username | password | activation_token |
-----------------------------------------------
| 1 | user1 | blabla | |
-----------------------------------------------
| 2 | user1 | blabla | asd232DA34qADJs2 |
-----------------------------------------------
Then I extract the activation_token along with the user-information whenever a users logs in. Or I could have a seperate table that contains activation tokens only, which is then joined on the 'users' table everytime a user logs in:
--------------------------------------
| id | account_id | activation_token |
--------------------------------------
| 1 | 37 | dsad2428491dka98 |
--------------------------------------
| 2 | 2 | asd232DA34qADJs2 |
--------------------------------------
So which one would be most efficient? Thanks for your time.
EDIT: Thanks for all the great responses