public function authenticate($request = [])
    {
        if ($request) {
            $this->email = clean($request['email']);
            $this->password = $this->getPasswordHelper()->hash(clean($request['password']));
        } else {
            $this->password = $this->getPasswordHelper()->hash(clean($this->password));
        }

        $query = $this->getManager()->newQuery();

        $query->where("email = ?", $this->email);
        $query->where("password = ?", $this->password);

        /** @var User $user */
        $user = $this->getManager()->findOneByQuery($query);

        if ($user) {
            $this->writeData($user->toArray());
            $this->doAuthentication();
        }

        return $this->authenticated();
    }
public function authenticate($request = [])
    {
        if ($request) {
            $this->email = clean($request['email']);
            $this->password = $this->getPasswordHelper()->hash(clean($request['password']));
        } else {
            $this->password = $this->getPasswordHelper()->hash(clean($this->password));
        }

        $query = $this->getManager()->newQuery();

        $query->where("email = ?", $this->email);
        $query->where("password = ?", $this->password);

        /** @var User $user */
        $user = $this->getManager()->findOneByQuery($query);

        if ($user) {
            $this->writeData($user->toArray());
            $this->doAuthentication();
        }

        return $this->authenticated();
    }
public function authenticate ( $ request = [ ] ) { if ( $ request ) { $ this -> email = clean ( $ request [ 'email' ] ) ; $ this -> password = $ this -> getPasswordHelper ( ) -> hash ( clean ( $ request [ 'password' ] ) ) ; } else { $ this -> password = $ this -> getPasswordHelper ( ) -> hash ( clean ( $ this -> password ) ) ; } $ query = $ this -> getManager ( ) -> newQuery ( ) ; $ query -> where ( "email = ?" , $ this -> email ) ; $ query -> where ( "password = ?" , $ this -> password ) ; /** @var User $user */ $ user = $ this -> getManager ( ) -> findOneByQuery ( $ query ) ; if ( $ user ) { $ this -> writeData ( $ user -> toArray ( ) ) ; $ this -> doAuthentication ( ) ; } return $ this -> authenticated ( ) ; }
Authenticate user from request

@param array $request
@return bool|null
Authenticate user from request