public function getEmail()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:auth:accounts:browse')) {
            throw new ApiException(
                'You are not authorised to browse users',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput = Factory::service('Input');
        $sEmail = $oInput->get('email');

        if (!valid_email($sEmail)) {
            throw new ApiException(
                '"' . $sEmail . '" is not a valid email',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oUserModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);
        $oUser      = $oUserModel->getByEmail($sEmail);

        if (empty($oUser)) {
            throw new ApiException(
                'No user found for email "' . $sEmail . '"',
                $oHttpCodes::STATUS_NOT_FOUND
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
            ->setData($this->formatObject($oUser));
    }
public function getEmail()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:auth:accounts:browse')) {
            throw new ApiException(
                'You are not authorised to browse users',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput = Factory::service('Input');
        $sEmail = $oInput->get('email');

        if (!valid_email($sEmail)) {
            throw new ApiException(
                '"' . $sEmail . '" is not a valid email',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oUserModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);
        $oUser      = $oUserModel->getByEmail($sEmail);

        if (empty($oUser)) {
            throw new ApiException(
                'No user found for email "' . $sEmail . '"',
                $oHttpCodes::STATUS_NOT_FOUND
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
            ->setData($this->formatObject($oUser));
    }
public function getEmail ( ) { $ oHttpCodes = Factory :: service ( 'HttpCodes' ) ; if ( ! userHasPermission ( 'admin:auth:accounts:browse' ) ) { throw new ApiException ( 'You are not authorised to browse users' , $ oHttpCodes :: STATUS_UNAUTHORIZED ) ; } $ oInput = Factory :: service ( 'Input' ) ; $ sEmail = $ oInput -> get ( 'email' ) ; if ( ! valid_email ( $ sEmail ) ) { throw new ApiException ( '"' . $ sEmail . '" is not a valid email' , $ oHttpCodes :: STATUS_BAD_REQUEST ) ; } $ oUserModel = Factory :: model ( static :: CONFIG_MODEL_NAME , static :: CONFIG_MODEL_PROVIDER ) ; $ oUser = $ oUserModel -> getByEmail ( $ sEmail ) ; if ( empty ( $ oUser ) ) { throw new ApiException ( 'No user found for email "' . $ sEmail . '"' , $ oHttpCodes :: STATUS_NOT_FOUND ) ; } return Factory :: factory ( 'ApiResponse' , 'nails/module-api' ) -> setData ( $ this -> formatObject ( $ oUser ) ) ; }
Returns a user by their email

@return array
Returns a user by their email