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', json_encode($this->ConfigureList)); $this->SetData('PreFocusAuthenticationScheme', $PreFocusAuthenticationScheme); $this->Render(); }