I have an existing table of users where the user passwords have not been 'hashed'. I am updating a website which will use this table, and this updated website will use the hash function.
However, the existing table just displays the passwords as normal text and are visible in the table.
My problem is that when older (existing) users try to log in with a password which has not been hashed, they can't log in, because (I think ) the password_verify
function I am using is looking for a hashed password. When it doesn't see the hashed password, logon fails.
if(password_verify($password, $teacher['password'])) //i.e.Password Match - only works with the password hash function!
I understand that for security, all passwords should now be hashed, and this will apply to new users signing up to the site. However, for existing users whose passwords are not hashed, what would be the best approach for allowing them to login with their existing password? I'm thinking along the lines of using a variation of the password_verify function which also checks non hashed passwords, and at the same time, mailing existing members and ask them to login to update their passwords - which would then 'hash them'.
So I guess my question is how do I amend my function to allow hashed and non-hashed passwords to be checked?