Here is an idea I've got to store no plain text password in both session and SQL (even if needed in post). Can you tell me what you do think about this way to proceed ?
//The password entered by user in plain text
$password = $_POST['password'];
//Get data
$req = $db -> prepare('SELECT * FROM users WHERE uid = ?');
$req -> execute(array($_POST['uid']));
$data = $req -> fetch();
//Verifying password
if(password_verify($password, $data['hashed_password']))
{
$_SESSION['rehash'] = password_hash($data['hashed_password'], PASSWORD_DEFAUT);
$_SESSION['uid'] = $_POST['uid'];
}
//When checking credentials on other pages of the website:
if(password_verify($data['hashed_password'], $_SESSION['rehash'])
{
//Private things here
}
I've seen a lot of topics on the same type of subject, and even if I don't think so, if this is a duplicate, feel free to close this topic.