Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | if ($request->isFormPost()) { | ||||
| } | } | ||||
| $pass = $request->getStr('new_pw'); | $pass = $request->getStr('new_pw'); | ||||
| $conf = $request->getStr('conf_pw'); | $conf = $request->getStr('conf_pw'); | ||||
| if (strlen($pass) < $min_len) { | if (strlen($pass) < $min_len) { | ||||
| $errors[] = pht('Your new password is too short.'); | $errors[] = pht('Your new password is too short.'); | ||||
| $e_new = pht('Too Short'); | $e_new = pht('Too Short'); | ||||
| } | } else if ($pass !== $conf) { | ||||
| if ($pass !== $conf) { | |||||
| $errors[] = pht('New password and confirmation do not match.'); | $errors[] = pht('New password and confirmation do not match.'); | ||||
| $e_conf = pht('Invalid'); | $e_conf = pht('Invalid'); | ||||
| } else if (PhabricatorCommonPasswords::isCommonPassword($pass)) { | |||||
| $e_new = pht('Very Weak'); | |||||
| $e_conf = pht('Very Weak'); | |||||
| $errors[] = pht( | |||||
| 'Your new password is very weak: it is one of the most common '. | |||||
| 'passwords in use. Choose a stronger password.'); | |||||
| } | } | ||||
| if (!$errors) { | if (!$errors) { | ||||
| // This write is unguarded because the CSRF token has already | // This write is unguarded because the CSRF token has already | ||||
| // been checked in the call to $request->isFormPost() and | // been checked in the call to $request->isFormPost() and | ||||
| // the CSRF token depends on the password hash, so when it | // the CSRF token depends on the password hash, so when it | ||||
| // is changed here the CSRF token check will fail. | // is changed here the CSRF token check will fail. | ||||
| $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||