/**
* Compares two passwords.
*
* This method implements a constant-time algorithm to compare passwords to
* avoid (remote) timing attacks.
*
* @param string $password1 The first password
* @param string $password2 The second password
*
* @return Boolean true if the two passwords are the same, false otherwise
*/
protected function comparePasswords($password1, $password2)
{
if (strlen($password1) !== strlen($password2)) {