Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15422369
D8051.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8051.id.diff
View Options
Index: src/applications/auth/provider/PhabricatorAuthProviderLDAP.php
===================================================================
--- src/applications/auth/provider/PhabricatorAuthProviderLDAP.php
+++ src/applications/auth/provider/PhabricatorAuthProviderLDAP.php
@@ -150,25 +150,27 @@
return array($account, $response);
}
- try {
- if (strlen($username) && $has_password) {
- $adapter = $this->getAdapter();
- $adapter->setLoginUsername($username);
- $adapter->setLoginPassword($password);
-
- // TODO: This calls ldap_bind() eventually, which dumps cleartext
- // passwords to the error log. See note in PhutilAuthAdapterLDAP.
- // See T3351.
-
- DarkConsoleErrorLogPluginAPI::enableDiscardMode();
- $account_id = $adapter->getAccountID();
- DarkConsoleErrorLogPluginAPI::disableDiscardMode();
- } else {
- throw new Exception("Username and password are required!");
+ if ($request->isFormPost()) {
+ try {
+ if (strlen($username) && $has_password) {
+ $adapter = $this->getAdapter();
+ $adapter->setLoginUsername($username);
+ $adapter->setLoginPassword($password);
+
+ // TODO: This calls ldap_bind() eventually, which dumps cleartext
+ // passwords to the error log. See note in PhutilAuthAdapterLDAP.
+ // See T3351.
+
+ DarkConsoleErrorLogPluginAPI::enableDiscardMode();
+ $account_id = $adapter->getAccountID();
+ DarkConsoleErrorLogPluginAPI::disableDiscardMode();
+ } else {
+ throw new Exception("Username and password are required!");
+ }
+ } catch (Exception $ex) {
+ // TODO: Make this cleaner.
+ throw $ex;
}
- } catch (Exception $ex) {
- // TODO: Make this cleaner.
- throw $ex;
}
return array($this->loadOrCreateAccount($account_id), $response);
Index: src/applications/auth/provider/PhabricatorAuthProviderPassword.php
===================================================================
--- src/applications/auth/provider/PhabricatorAuthProviderPassword.php
+++ src/applications/auth/provider/PhabricatorAuthProviderPassword.php
@@ -163,22 +163,25 @@
$account = null;
$log_user = null;
- if (!$require_captcha || $captcha_valid) {
- $username_or_email = $request->getStr('username');
- if (strlen($username_or_email)) {
- $user = id(new PhabricatorUser())->loadOneWhere(
- 'username = %s',
- $username_or_email);
-
- if (!$user) {
- $user = PhabricatorUser::loadOneWithEmailAddress($username_or_email);
- }
+ if ($request->isFormPost()) {
+ if (!$require_captcha || $captcha_valid) {
+ $username_or_email = $request->getStr('username');
+ if (strlen($username_or_email)) {
+ $user = id(new PhabricatorUser())->loadOneWhere(
+ 'username = %s',
+ $username_or_email);
+
+ if (!$user) {
+ $user = PhabricatorUser::loadOneWithEmailAddress(
+ $username_or_email);
+ }
- if ($user) {
- $envelope = new PhutilOpaqueEnvelope($request->getStr('password'));
- if ($user->comparePassword($envelope)) {
- $account = $this->loadOrCreateAccount($user->getPHID());
- $log_user = $user;
+ if ($user) {
+ $envelope = new PhutilOpaqueEnvelope($request->getStr('password'));
+ if ($user->comparePassword($envelope)) {
+ $account = $this->loadOrCreateAccount($user->getPHID());
+ $log_user = $user;
+ }
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 23, 7:42 AM (3 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7229572
Default Alt Text
D8051.id.diff (3 KB)
Attached To
Mode
D8051: Actually check CSRF on Password and LDAP forms
Attached
Detach File
Event Timeline
Log In to Comment