Skip to content

Commit

Permalink
account-settings: Pass password page params to dialog widget.
Browse files Browse the repository at this point in the history
When the password change form was converted to a dialog widget
modal, in commit f5fbf5f, the page_params values for
password_min_length and password_min_guesses that were referenced
in the handlebars template `dialog_change_password.hbs` had no
value to set, which meant the password quality bar was no longer
checking the input value against those organization settings.

Passes the page_params values for password_min_length and
password_min_guesses to the html parameter in dialog_widet.launch
for the password change modal so that those values are available
and set when the template is rendered.
  • Loading branch information
laurynmm authored and timabbott committed Mar 22, 2023
1 parent 126f3b5 commit 25fb810
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion web/src/settings_account.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,10 @@ export function set_up() {

dialog_widget.launch({
html_heading: $t_html({defaultMessage: "Change password"}),
html_body: render_dialog_change_password(),
html_body: render_dialog_change_password({
password_min_length: page_params.password_min_length,
password_min_guesses: page_params.password_min_guesses,
}),
html_submit_button: $t_html({defaultMessage: "Change"}),
loading_spinner: true,
id: "change_password_modal",
Expand Down
2 changes: 1 addition & 1 deletion web/templates/dialog_change_password.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="field password-div">
<label for="new_password" class="title">{{t "New password" }}</label>
<input type="password" autocomplete="new-password" name="new_password" id="new_password" class="w-200 inline-block" value=""
data-min-length="{{ page_params.password_min_length }}" data-min-guesses="{{ page_params.password_min_guesses }}" />
data-min-length="{{password_min_length}}" data-min-guesses="{{password_min_guesses}}" />
<i class="fa fa-eye-slash password_visibility_toggle tippy-zulip-tooltip" role="button"></i>
<div class="progress inline-block" id="pw_strength">
<div class="bar bar-danger fade" style="width: 10%;"></div>
Expand Down

0 comments on commit 25fb810

Please sign in to comment.