protected function requestData(&$aRequiredData, $provider)
    {
        $oInput = Factory::service('Input');
        if ($oInput->post()) {

            $oFormValidation = Factory::service('FormValidation');

            if (isset($aRequiredData['email'])) {
                $oFormValidation->set_rules('email', 'email', 'trim|required|valid_email|is_unique[' . NAILS_DB_PREFIX . 'user_email.email]');
            }

            if (isset($aRequiredData['username'])) {
                $oFormValidation->set_rules('username', 'username', 'trim|required|is_unique[' . NAILS_DB_PREFIX . 'user.username]');
            }

            if (empty($aRequiredData['first_name'])) {
                $oFormValidation->set_rules('first_name', '', 'trim|required');
            }

            if (empty($aRequiredData['last_name'])) {
                $oFormValidation->set_rules('last_name', '', 'trim|required');
            }

            $oFormValidation->set_message('required', lang('fv_required'));
            $oFormValidation->set_message('valid_email', lang('fv_valid_email'));

            if (APP_NATIVE_LOGIN_USING == 'EMAIL') {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_email_already_registered', site_url('auth/password/forgotten'))
                );
            } elseif (APP_NATIVE_LOGIN_USING == 'USERNAME') {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_username_already_registered', site_url('auth/password/forgotten'))
                );
            } else {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_identity_already_registered', site_url('auth/password/forgotten'))
                );
            }

            if ($oFormValidation->run()) {

                //  Valid!Ensure required data is set correctly then allow system to move on.
                if (isset($aRequiredData['email'])) {
                    $aRequiredData['email'] = $oInput->post('email');
                }

                if (isset($aRequiredData['username'])) {
                    $aRequiredData['username'] = $oInput->post('username');
                }

                if (empty($aRequiredData['first_name'])) {
                    $aRequiredData['first_name'] = $oInput->post('first_name');
                }

                if (empty($aRequiredData['last_name'])) {
                    $aRequiredData['last_name'] = $oInput->post('last_name');
                }

            } else {
                $this->data['error'] = lang('fv_there_were_errors');
                $this->requestDataForm($aRequiredData, $provider);
            }

        } else {
            $this->requestDataForm($aRequiredData, $provider);
        }
    }
protected function requestData(&$aRequiredData, $provider)
    {
        $oInput = Factory::service('Input');
        if ($oInput->post()) {

            $oFormValidation = Factory::service('FormValidation');

            if (isset($aRequiredData['email'])) {
                $oFormValidation->set_rules('email', 'email', 'trim|required|valid_email|is_unique[' . NAILS_DB_PREFIX . 'user_email.email]');
            }

            if (isset($aRequiredData['username'])) {
                $oFormValidation->set_rules('username', 'username', 'trim|required|is_unique[' . NAILS_DB_PREFIX . 'user.username]');
            }

            if (empty($aRequiredData['first_name'])) {
                $oFormValidation->set_rules('first_name', '', 'trim|required');
            }

            if (empty($aRequiredData['last_name'])) {
                $oFormValidation->set_rules('last_name', '', 'trim|required');
            }

            $oFormValidation->set_message('required', lang('fv_required'));
            $oFormValidation->set_message('valid_email', lang('fv_valid_email'));

            if (APP_NATIVE_LOGIN_USING == 'EMAIL') {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_email_already_registered', site_url('auth/password/forgotten'))
                );
            } elseif (APP_NATIVE_LOGIN_USING == 'USERNAME') {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_username_already_registered', site_url('auth/password/forgotten'))
                );
            } else {
                $oFormValidation->set_message(
                    'is_unique',
                    lang('fv_identity_already_registered', site_url('auth/password/forgotten'))
                );
            }

            if ($oFormValidation->run()) {

                //  Valid!Ensure required data is set correctly then allow system to move on.
                if (isset($aRequiredData['email'])) {
                    $aRequiredData['email'] = $oInput->post('email');
                }

                if (isset($aRequiredData['username'])) {
                    $aRequiredData['username'] = $oInput->post('username');
                }

                if (empty($aRequiredData['first_name'])) {
                    $aRequiredData['first_name'] = $oInput->post('first_name');
                }

                if (empty($aRequiredData['last_name'])) {
                    $aRequiredData['last_name'] = $oInput->post('last_name');
                }

            } else {
                $this->data['error'] = lang('fv_there_were_errors');
                $this->requestDataForm($aRequiredData, $provider);
            }

        } else {
            $this->requestDataForm($aRequiredData, $provider);
        }
    }
protected function requestData ( & $ aRequiredData , $ provider ) { $ oInput = Factory :: service ( 'Input' ) ; if ( $ oInput -> post ( ) ) { $ oFormValidation = Factory :: service ( 'FormValidation' ) ; if ( isset ( $ aRequiredData [ 'email' ] ) ) { $ oFormValidation -> set_rules ( 'email' , 'email' , 'trim|required|valid_email|is_unique[' . NAILS_DB_PREFIX . 'user_email.email]' ) ; } if ( isset ( $ aRequiredData [ 'username' ] ) ) { $ oFormValidation -> set_rules ( 'username' , 'username' , 'trim|required|is_unique[' . NAILS_DB_PREFIX . 'user.username]' ) ; } if ( empty ( $ aRequiredData [ 'first_name' ] ) ) { $ oFormValidation -> set_rules ( 'first_name' , '' , 'trim|required' ) ; } if ( empty ( $ aRequiredData [ 'last_name' ] ) ) { $ oFormValidation -> set_rules ( 'last_name' , '' , 'trim|required' ) ; } $ oFormValidation -> set_message ( 'required' , lang ( 'fv_required' ) ) ; $ oFormValidation -> set_message ( 'valid_email' , lang ( 'fv_valid_email' ) ) ; if ( APP_NATIVE_LOGIN_USING == 'EMAIL' ) { $ oFormValidation -> set_message ( 'is_unique' , lang ( 'fv_email_already_registered' , site_url ( 'auth/password/forgotten' ) ) ) ; } elseif ( APP_NATIVE_LOGIN_USING == 'USERNAME' ) { $ oFormValidation -> set_message ( 'is_unique' , lang ( 'fv_username_already_registered' , site_url ( 'auth/password/forgotten' ) ) ) ; } else { $ oFormValidation -> set_message ( 'is_unique' , lang ( 'fv_identity_already_registered' , site_url ( 'auth/password/forgotten' ) ) ) ; } if ( $ oFormValidation -> run ( ) ) { //  Valid!Ensure required data is set correctly then allow system to move on. if ( isset ( $ aRequiredData [ 'email' ] ) ) { $ aRequiredData [ 'email' ] = $ oInput -> post ( 'email' ) ; } if ( isset ( $ aRequiredData [ 'username' ] ) ) { $ aRequiredData [ 'username' ] = $ oInput -> post ( 'username' ) ; } if ( empty ( $ aRequiredData [ 'first_name' ] ) ) { $ aRequiredData [ 'first_name' ] = $ oInput -> post ( 'first_name' ) ; } if ( empty ( $ aRequiredData [ 'last_name' ] ) ) { $ aRequiredData [ 'last_name' ] = $ oInput -> post ( 'last_name' ) ; } } else { $ this -> data [ 'error' ] = lang ( 'fv_there_were_errors' ) ; $ this -> requestDataForm ( $ aRequiredData , $ provider ) ; } } else { $ this -> requestDataForm ( $ aRequiredData , $ provider ) ; } }
Handles requesting of additional data from the user

@param  array  &$aRequiredData An array of fields to request
@param  string  $provider      The provider to use

@throws \Nails\Common\Exception\FactoryException
Handles requesting of additional data from the user