Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/provider/PhabricatorAuthProviderLDAP.php
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
| // TODO: This calls ldap_bind() eventually, which dumps cleartext | // TODO: This calls ldap_bind() eventually, which dumps cleartext | ||||
| // passwords to the error log. See note in PhutilAuthAdapterLDAP. | // passwords to the error log. See note in PhutilAuthAdapterLDAP. | ||||
| // See T3351. | // See T3351. | ||||
| DarkConsoleErrorLogPluginAPI::enableDiscardMode(); | DarkConsoleErrorLogPluginAPI::enableDiscardMode(); | ||||
| $account_id = $adapter->getAccountID(); | $account_id = $adapter->getAccountID(); | ||||
| DarkConsoleErrorLogPluginAPI::disableDiscardMode(); | DarkConsoleErrorLogPluginAPI::disableDiscardMode(); | ||||
| } else { | } else { | ||||
| throw new Exception("Username and password are required!"); | throw new Exception('Username and password are required!'); | ||||
| } | } | ||||
| } catch (PhutilAuthCredentialException $ex) { | } catch (PhutilAuthCredentialException $ex) { | ||||
| $response = $controller->buildProviderPageResponse( | $response = $controller->buildProviderPageResponse( | ||||
| $this, | $this, | ||||
| $this->renderLoginForm($request, 'login')); | $this->renderLoginForm($request, 'login')); | ||||
| return array($account, $response); | return array($account, $response); | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| // TODO: Make this cleaner. | // TODO: Make this cleaner. | ||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | $instructions = array( | ||||
| "with either their email address or username, but only if they're in ". | "with either their email address or username, but only if they're in ". | ||||
| "specific departments:\n\n". | "specific departments:\n\n". | ||||
| " lang=text,name=Complex Example\n". | " lang=text,name=Complex Example\n". | ||||
| " (&(mail=\${login})(|(departmentNumber=1)(departmentNumber=2)))\n". | " (&(mail=\${login})(|(departmentNumber=1)(departmentNumber=2)))\n". | ||||
| " (&(sn=\${login})(|(departmentNumber=1)(departmentNumber=2)))\n\n". | " (&(sn=\${login})(|(departmentNumber=1)(departmentNumber=2)))\n\n". | ||||
| "All of the attribute names used here are just examples: your LDAP ". | "All of the attribute names used here are just examples: your LDAP ". | ||||
| "server may use different attribute names."), | "server may use different attribute names."), | ||||
| self::KEY_ALWAYS_SEARCH => pht( | self::KEY_ALWAYS_SEARCH => pht( | ||||
| "To search for an LDAP record before authenticating, either check ". | 'To search for an LDAP record before authenticating, either check '. | ||||
| "the **Always Search** checkbox or enter an anonymous ". | 'the **Always Search** checkbox or enter an anonymous '. | ||||
| "username and password to use to perform the search."), | 'username and password to use to perform the search.'), | ||||
| self::KEY_USERNAME_ATTRIBUTE => pht( | self::KEY_USERNAME_ATTRIBUTE => pht( | ||||
| "Optionally, specify a username attribute to use to prefill usernames ". | 'Optionally, specify a username attribute to use to prefill usernames '. | ||||
| "when registering a new account. This is purely cosmetic and does not ". | 'when registering a new account. This is purely cosmetic and does not '. | ||||
| "affect the login process, but you can configure it to make sure ". | 'affect the login process, but you can configure it to make sure '. | ||||
| "users get the same default username as their LDAP username, so ". | 'users get the same default username as their LDAP username, so '. | ||||
| "usernames remain consistent across systems."), | 'usernames remain consistent across systems.'), | ||||
| self::KEY_REALNAME_ATTRIBUTES => pht( | self::KEY_REALNAME_ATTRIBUTES => pht( | ||||
| "Optionally, specify one or more comma-separated attributes to use to ". | 'Optionally, specify one or more comma-separated attributes to use to '. | ||||
| "prefill the \"Real Name\" field when registering a new account. This ". | 'prefill the "Real Name" field when registering a new account. This '. | ||||
| "is purely cosmetic and does not affect the login process, but can ". | 'is purely cosmetic and does not affect the login process, but can '. | ||||
| "make registration a little easier."), | 'make registration a little easier.'), | ||||
| ); | ); | ||||
| foreach ($labels as $key => $label) { | foreach ($labels as $key => $label) { | ||||
| $caption = idx($captions, $key); | $caption = idx($captions, $key); | ||||
| $type = idx($types, $key); | $type = idx($types, $key); | ||||
| $value = idx($values, $key); | $value = idx($values, $key); | ||||
| $control = null; | $control = null; | ||||
| ▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines | |||||