public function login($aPlainPassword, UserPasswordEncoder $anEncoder)
    {
        if (false === $this->isEnabled()) {
            throw new UserInactiveException();
        }
        if (false === $this->password()->equals($aPlainPassword, $anEncoder)) {
            throw new UserPasswordInvalidException();
        }
        $this->lastLogin = new \DateTimeImmutable();

        $this->publish(
            new UserLoggedIn(
                $this->id,
                $this->email
            )
        );
    }
public function login($aPlainPassword, UserPasswordEncoder $anEncoder)
    {
        if (false === $this->isEnabled()) {
            throw new UserInactiveException();
        }
        if (false === $this->password()->equals($aPlainPassword, $anEncoder)) {
            throw new UserPasswordInvalidException();
        }
        $this->lastLogin = new \DateTimeImmutable();

        $this->publish(
            new UserLoggedIn(
                $this->id,
                $this->email
            )
        );
    }
public function login ( $ aPlainPassword , UserPasswordEncoder $ anEncoder ) { if ( false === $ this -> isEnabled ( ) ) { throw new UserInactiveException ( ) ; } if ( false === $ this -> password ( ) -> equals ( $ aPlainPassword , $ anEncoder ) ) { throw new UserPasswordInvalidException ( ) ; } $ this -> lastLogin = new \ DateTimeImmutable ( ) ; $ this -> publish ( new UserLoggedIn ( $ this -> id , $ this -> email ) ) ; }
Validates user login for the given password.

@param string              $aPlainPassword Plain password used to log in
@param UserPasswordEncoder $anEncoder      The encoder used to encode the password

@throws UserInactiveException        when the user is not enabled
@throws UserPasswordInvalidException when the user password is invalid
Validates user login for the given password .