Hello my question is if it is better to have a temporary_users table in my mySQL DB for those users who did not verify by email their account yet. If a user is verified then his data is copied into the users table.
Otherwise, all users, verified or not, will be saved in users table where there will be a new column with a random number. When the user is verified, that value will erased meaning that he is ok to login.
In the future I will create a forgot password function with the same structure as you suggest me.
What is the best method to have ?
Store all users in a single table, and store validation/not-validated state with each record. Whether you add a
is_validatedcolumn, or simply store a unique token and set it tonullfor validated users is up to you.Duplicating an entire table for the sake of adding a single column of data is not a very good practice, and it will be unwieldy; You want to be able to find the user based on their login credentials, and tell them their account is not yet activated. To do this with two tables will require two queries.