1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Extract ldap auth from password auth completely

This commit is contained in:
linead 2012-06-25 10:48:36 +10:00 committed by epriestley
parent bedc9acf98
commit e683236793

View file

@ -77,14 +77,14 @@ final class PhabricatorLoginController
$password_auth = PhabricatorEnv::getEnvConfig('auth.password-auth-enabled'); $password_auth = PhabricatorEnv::getEnvConfig('auth.password-auth-enabled');
$forms = array(); $username_or_email = $request->getCookie('phusr');
$forms = array();
$errors = array(); $errors = array();
if ($password_auth) { if ($password_auth) {
$require_captcha = false; $require_captcha = false;
$e_captcha = true; $e_captcha = true;
$username_or_email = $request->getCookie('phusr');
if ($request->isFormPost()) { if ($request->isFormPost()) {
if (AphrontFormRecaptchaControl::isRecaptchaEnabled()) { if (AphrontFormRecaptchaControl::isRecaptchaEnabled()) {
@ -188,29 +188,30 @@ final class PhabricatorLoginController
// $panel->setCreateButton('Register New Account', '/login/register/'); // $panel->setCreateButton('Register New Account', '/login/register/');
$forms['Phabricator Login'] = $form; $forms['Phabricator Login'] = $form;
$ldap_provider = new PhabricatorLDAPProvider(); }
if ($ldap_provider->isProviderEnabled()) {
$ldap_form = new AphrontFormView();
$ldap_form
->setUser($request->getUser())
->setAction('/ldap/login/')
->appendChild(
id(new AphrontFormTextControl())
->setLabel('LDAP username')
->setName('username')
->setValue($username_or_email))
->appendChild(
id(new AphrontFormPasswordControl())
->setLabel('Password')
->setName('password'));
$ldap_form $ldap_provider = new PhabricatorLDAPProvider();
->appendChild( if ($ldap_provider->isProviderEnabled()) {
id(new AphrontFormSubmitControl()) $ldap_form = new AphrontFormView();
->setValue('Login')); $ldap_form
->setUser($request->getUser())
->setAction('/ldap/login/')
->appendChild(
id(new AphrontFormTextControl())
->setLabel('LDAP username')
->setName('username')
->setValue($username_or_email))
->appendChild(
id(new AphrontFormPasswordControl())
->setLabel('Password')
->setName('password'));
$forms['LDAP Login'] = $ldap_form; $ldap_form
} ->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Login'));
$forms['LDAP Login'] = $ldap_form;
} }
$providers = PhabricatorOAuthProvider::getAllProviders(); $providers = PhabricatorOAuthProvider::getAllProviders();