/**
* Check if user authentication succeeds on phpbb site and if so update contao member
*
* @param $username
* @param $password
* @param User $user
* @return bool
*/
public function onCheckCredentials($username, $password, User $user)
{
// Only try to login if it's frontend user
if ($user instanceof FrontendUser) {
$loginResult = System::getContainer()->get('phpbb_bridge.connector')->validateLogin($username, $password);
// Login was successful on phpbb side. Maybe user changed his password. So do we for contao then
if ($loginResult === true) {
$user->password = Encryption::hash($password);
$user->save();
return true;
}
}
return false;
}