{"record":{"id":"2ccc2945123b7dd5","repo":"phacility/phabricator","slug":"you-must-choose-a-password-or-skip-this-step","errorCode":null,"errorMessage":"You must choose a password or skip this step.","messagePattern":"You must choose a password or skip this step\\.","errorType":"validation","errorClass":"PhabricatorAuthPasswordException","httpStatus":null,"severity":"warning","filePath":"src/applications/auth/engine/PhabricatorAuthPasswordEngine.php","lineNumber":66,"sourceCode":"  public function setUpgradeHashers($upgrade_hashers) {\n    $this->upgradeHashers = $upgrade_hashers;\n    return $this;\n  }\n\n  public function getUpgradeHashers() {\n    return $this->upgradeHashers;\n  }\n\n  public function checkNewPassword(\n    PhutilOpaqueEnvelope $password,\n    PhutilOpaqueEnvelope $confirm,\n    $can_skip = false) {\n\n    $raw_password = $password->openEnvelope();\n\n    if (!strlen($raw_password)) {\n      if ($can_skip) {\n        throw new PhabricatorAuthPasswordException(\n          pht('You must choose a password or skip this step.'),\n          pht('Required'));\n      } else {\n        throw new PhabricatorAuthPasswordException(\n          pht('You must choose a password.'),\n          pht('Required'));\n      }\n    }\n\n    $min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length');\n    $min_len = (int)$min_len;\n    if ($min_len) {\n      if (strlen($raw_password) < $min_len) {\n        throw new PhabricatorAuthPasswordException(\n          pht(\n            'The selected password is too short. Passwords must be a minimum '.\n            'of %s characters long.',\n            new PhutilNumber($min_len)),","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php#L48-L84","documentation":"checkNewPassword() validates the primary password field first: if the raw password is empty and the caller passed can_skip=true (e.g., a registration or settings step where skipping is permitted), this exception tells the user they must either supply a password or explicitly skip. The second constructor argument ('Required') becomes getPasswordError(), which the UI attaches to the password form field.","triggerScenarios":"Submitting a password set/registration form with an empty password string while $can_skip is true - i.e., the caller wants skip to be an explicit choice rather than silently accepting a blank field.","commonSituations":"First-login/set-password flows where users leave the field blank and expect the form's 'skip' button/checkbox to be used; custom forms calling checkNewPassword($password, $confirm, true) without implementing the skip affordance.","solutions":["Type a password, or use the form's explicit skip action instead of submitting an empty field.","If building a custom form, provide a separate skip control so users are not forced into the empty-submit path.","Catch PhabricatorAuthPasswordException and render getPasswordError() on the password field."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Guard the explicit skip case before calling the engine\nif (!strlen($password->openEnvelope())) {\n  if (!$request->getBool('skipPassword')) {\n    // render 'You must choose a password or skip this step.' yourself,\n    // or provide the skip control\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  $engine->checkNewPassword($password, $confirm, $can_skip = true);\n} catch (PhabricatorAuthPasswordException $ex) {\n  $e_password = $ex->getPasswordError(); // 'Required'\n  return $this->newDialog()->addFormControl(/* ... */);\n}","preventionTips":["In flows with can_skip, always provide a distinct skip control so empty submits never reach the engine.","Mark both password inputs as required in forms where skipping is not offered.","Use getPasswordError()/getConfirmError() to decorate the exact fields."],"tags":["phabricator","password","validation","empty-input","php"],"backgroundTag":"password-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}