} if (!empty($_errors)) { $_headline = isset($alertMessage) ? $alertMessage : 'Sorry pal...'; $_messages = null; foreach ($_errors as $_error) { foreach ($_error as $_message) { $_messages .= '<p>' . $_message . '</p>'; } } echo <<<HTML <div class="alert alert-error alert-block alert-fixed fade in" data-alert="alert"> \t<strong>{$_headline}</strong> \t{$_messages}</div> HTML; } if (null !== ($_status = Pii::getState('status_message'))) { echo <<<HTML <div class="alert alert-success alert-block fade in" data-alert="alert"> \t<strong>Success!</strong><br/> \t{$_status} </div> HTML; Pii::clearState('status_message'); } $_hashedId = $model->isNewRecord ? null : $this->hashId($model->id); $_form = new BootstrapForm(Bootstrap::Horizontal, array('id' => 'update-resource', 'method' => 'POST', 'x_editable_url' => '/admin/' . $resourceName . '/update', 'x_editable_pk' => $_hashedId, 'prefix' => $_prefix)); // Make sure the renderer removes these... $_form->setRemovePrefix(ConsoleController::SCHEMA_PREFIX); $_form->setFormData($model->getAttributes()); $_fields = array('Basic Settings' => array('api_name' => array('type' => 'text', 'class' => $model->isNewRecord ? 'required' : 'uneditable-input', 'placeholder' => 'How to address this provider via REST', 'hint' => 'The URI portion to be used when calling this provider. For example: "github", or "facebook".', 'maxlength' => 64), 'provider_name' => array('type' => 'text', 'class' => 'required' . ($_update ? ' x-editable' : null), 'hint' => 'The real name, or "display" name for this provider.', 'maxlength' => 64)), 'Configuration' => $schema, 'Metrics' => array('created_date' => array('type' => 'text', 'class' => 'uneditable-input'), 'last_modified_date' => array('type' => 'text', 'class' => 'uneditable-input'))); ?>
/** * Action for URL that the client redirects to when coming back from providers. */ public function actionRemoteLogin() { if (null !== $this->_remoteError) { $this->_redirectError($this->_remoteError); } if (null === ($_providerId = Option::request('pid'))) { throw new BadRequestException('No remote login provider specified.'); } $this->layout = false; $_flow = FilterInput::request('flow', Flows::CLIENT_SIDE, FILTER_SANITIZE_NUMBER_INT); // Check local then global... if (null === ($_providerModel = Provider::model()->byPortal($_providerId)->find())) { /** @var \stdClass $_providerModel */ $_providerModel = Fabric::getProviderCredentials($_providerId); if (empty($_providerModel)) { throw new BadRequestException('The provider "' . $_providerId . '" is not available.'); } // Translate from back-end to front-end $_model = new stdClass(); $_model->id = $_providerModel->id; $_model->provider_name = $_providerModel->provider_name_text; $_model->config_text = $_providerModel->config_text; $_model->api_name = $_providerModel->endpoint_text; $_model->is_active = $_providerModel->enable_ind; $_model->is_login_provider = $_providerModel->login_provider_ind; $_providerModel = $_model; } // Set our store... Oasys::setStore($_store = new ProviderUserStore(Session::getCurrentUserId(), $_providerModel->id)); $_config = Provider::buildConfig($_providerModel, Pii::getState($_providerId . '.user_config', array()), array('flow_type' => $_flow, 'redirect_uri' => Curl::currentUrl(false) . '?pid=' . $_providerModel->provider_name)); $_provider = Oasys::getProvider($_providerId, $_config); if ($_provider->handleRequest()) { // Now let the user model figure out what to do... try { $_user = User::remoteLoginRequest($_providerId, $_provider, $_providerModel); Log::debug('Remote login success: ' . $_user->email . ' (id#' . $_user->id . ')'); } catch (\Exception $_ex) { Log::error($_ex->getMessage()); // No soup for you! $this->_redirectError($_ex->getMessage()); } // Go home baby! $this->redirect('/'); } Log::error('Seems that the provider rejected the login...'); $this->_redirectError('Error during remote login sequence. Please try again.'); }
use Kisma\Core\Utility\Curl; use Kisma\Core\Utility\FilterInput; /** * @var string $content * @var ConsoleController $this */ $_route = $this->route; $_step = 'light'; $_headline = 'DSP Settings'; $_themeList = null; // Change these to update the CDN versions used. Set to false to disable $_bootstrapVersion = '3.1.1'; // Set to false to disable $_bootswatchVersion = '3.1.1'; $_dataTablesVersion = '1.9.4'; $_bootswatchTheme = FilterInput::request('theme', Pii::getState('admin.default_theme', 'default'), FILTER_SANITIZE_STRING); Pii::setState('dsp.admin_theme', $_bootswatchTheme); $_useBootswatchThemes = 'default' != $_bootswatchTheme; $_fontAwesomeVersion = '4.0.3'; // Set to false to disable $_jqueryVersion = '1.11.0'; $_themes = array('Default', 'Amelia', 'Cerulean', 'Cosmo', 'Cyborg', 'Flatly', 'Journal', 'Readable', 'Simplex', 'Slate', 'Spacelab', 'United'); $_url = Curl::currentUrl(false); foreach ($_themes as $_item) { $_name = strtolower($_item); $_class = $_bootswatchTheme == $_name ? 'class="active"' : null; $_themeList .= <<<HTML \t<li {$_class}><a href="{$_url}?theme={$_name}">{$_item}</a></li> HTML; } // Our css building begins...