/** * Select Authentication method. * * @since 2.0.3 * @access public * * @param string $AuthenticationSchemeAlias */ public function choose($AuthenticationSchemeAlias = null) { $this->permission('Garden.Settings.Manage'); $this->addSideMenu('dashboard/authentication'); $this->title(t('Authentication')); $this->addCssFile('authentication.css'); $PreFocusAuthenticationScheme = null; if (!is_null($AuthenticationSchemeAlias)) { $PreFocusAuthenticationScheme = $AuthenticationSchemeAlias; } if ($this->Form->authenticatedPostback()) { $NewAuthSchemeAlias = $this->Form->getValue('Garden.Authentication.Chooser'); $AuthenticatorInfo = Gdn::authenticator()->getAuthenticatorInfo($NewAuthSchemeAlias); if ($AuthenticatorInfo !== false) { $CurrentAuthenticatorAlias = Gdn::authenticator()->AuthenticateWith('default')->getAuthenticationSchemeAlias(); // Disable current $AuthenticatorDisableEvent = "DisableAuthenticator" . ucfirst($CurrentAuthenticatorAlias); $this->fireEvent($AuthenticatorDisableEvent); // Enable new $AuthenticatorEnableEvent = "EnableAuthenticator" . ucfirst($NewAuthSchemeAlias); $this->fireEvent($AuthenticatorEnableEvent); $PreFocusAuthenticationScheme = $NewAuthSchemeAlias; $this->CurrentAuthenticationAlias = Gdn::authenticator()->authenticateWith('default')->getAuthenticationSchemeAlias(); } } $this->setData('AuthenticationConfigureList', $this->ConfigureList); $this->setData('PreFocusAuthenticationScheme', $PreFocusAuthenticationScheme); $this->render(); }