mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
signup: Don't run password_strength form validator in ldap signup mode.
When an ldap user is signing up via the registration form, they are required to enter their ldap password. This is in contract to "regular" password signup, where the user sets the password for their new account. Checking password strength makes sense in the latter case, but not in the ldap case - the password is already set at the ldap level after all. In any case, the password_strength validator is not even added to the form field with `id="ldap-password"`, so this was bugged throwing errors such as ``` TypeError: $.validator.methods[method] is undefined. Exception occurred when checking element ldap-password, check the 'password_strength' method. at http://localhost:9991/webpack/vendors-node_modules_pnpm_jquery-validation_1_21_0_jquery_3_7_1_node_modules_jquery-validatio-b912f7.js:810 at check .pnpm/jquery-validation@1.21.0_jquery@3.7.1/node_modules/jquery-validation/dist/jquery.validate.js:803 at element .pnpm/jquery-validation@1.21.0_jquery@3.7.1/node_modules/jquery-validation/dist/jquery.validate.js:510 at onfocusout .pnpm/jquery-validation@1.21.0_jquery@3.7.1/node_modules/jquery-validation/dist/jquery.validate.js:310 at delegate .pnpm/jquery-validation@1.21.0_jquery@3.7.1/node_modules/jquery-validation/dist/jquery.validate.js:441 at dispatch .pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.js:5145 at ../node_modules/.pnpm/jquery jquery/dist/jquery.js?1d73/</add/elemData.handle@http://localhost:9991/webpack/vendors-node_modules_pnpm_error-stack-parser_2_1_4_node_modules_error-stack-parser_error-stac-967546.js:16502 at trigger .pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.js:8629 at simulate .pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.js:8698 at focusMappedHandler .pnpm/jquery@3.7.1/node_modules/jquery/dist/jquery.js:5574 ``` when interacting with the form.
This commit is contained in:
committed by
Tim Abbott
parent
b5ab90aaa4
commit
4bc70f7c04
@@ -60,7 +60,16 @@ $(() => {
|
||||
|
||||
$("#registration, #password_reset, #create_realm").validate({
|
||||
rules: {
|
||||
password: "password_strength",
|
||||
password: {
|
||||
password_strength: {
|
||||
depends(element: HTMLElement): boolean {
|
||||
// In the registration flow where the user is required to
|
||||
// enter their LDAP password, we don't check password strength,
|
||||
// and the validator method is not even set up.
|
||||
return element.id !== "ldap-password";
|
||||
},
|
||||
},
|
||||
},
|
||||
new_password1: "password_strength",
|
||||
},
|
||||
errorElement: "p",
|
||||
|
Reference in New Issue
Block a user