|
22 | 22 | import com.smartgwt.client.widgets.form.DynamicForm; |
23 | 23 | import com.smartgwt.client.widgets.form.ValuesManager; |
24 | 24 | import com.smartgwt.client.widgets.form.fields.ButtonItem; |
| 25 | +import com.smartgwt.client.widgets.form.fields.FormItemIcon; |
25 | 26 | import com.smartgwt.client.widgets.form.fields.PasswordItem; |
26 | 27 | import com.smartgwt.client.widgets.form.fields.events.ClickEvent; |
| 28 | +import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent; |
27 | 29 | import com.smartgwt.client.widgets.form.validator.MatchesFieldValidator; |
28 | 30 |
|
29 | 31 | /** |
@@ -59,18 +61,31 @@ public ChangePassword(final GUIUser user, final LoginPanel loginPanel) { |
59 | 61 | form.setWidth(300); |
60 | 62 | form.setMargin(5); |
61 | 63 |
|
62 | | - PasswordItem password = ItemFactory.newPasswordItemPreventAutocomplete(PASSWORD, PASSWORD, null); |
| 64 | + PasswordItem password = ItemFactory.newPasswordItemPreventAutocomplete(PASSWORD, "currentpassword", null); |
63 | 65 | password.setRequired(true); |
64 | 66 |
|
65 | 67 | MatchesFieldValidator equalsValidator = new MatchesFieldValidator(); |
66 | 68 | equalsValidator.setOtherField(NEWPASSWORDAGAIN); |
67 | 69 | equalsValidator.setErrorMessage(I18N.message("passwordnotmatch")); |
68 | 70 |
|
69 | | - PasswordItem newPass = ItemFactory.newPasswordItemPreventAutocomplete(NEWPASSWORD, NEWPASSWORD, null, true); |
70 | | - newPass.setWrapTitle(false); |
| 71 | + PasswordItem newPass = ItemFactory.newPasswordItemPreventAutocomplete(NEWPASSWORD, NEWPASSWORD, null); |
71 | 72 | newPass.setRequired(true); |
72 | 73 | newPass.setValidators(equalsValidator, new MinLengthValidator(user.getPasswordMinLenght())); |
73 | 74 |
|
| 75 | + FormItemIcon generator = new FormItemIcon(); |
| 76 | + generator.setName("generator"); |
| 77 | + generator.setWidth(16); |
| 78 | + generator.setHeight(16); |
| 79 | + |
| 80 | + generator.setSrc("[SKIN]/icons/key.png"); |
| 81 | + generator.setPrompt(I18N.message("passwordgenerator")); |
| 82 | + generator.addFormItemClickHandler((FormItemIconClickEvent event) -> { |
| 83 | + PasswordGenerator pswGenerator = new PasswordGenerator(user.getUsername()); |
| 84 | + pswGenerator.show(); |
| 85 | + }); |
| 86 | + newPass.setIcons(generator); |
| 87 | + newPass.setIconVAlign(VerticalAlignment.CENTER); |
| 88 | + |
74 | 89 | PasswordItem newPassAgain = ItemFactory.newPasswordItemPreventAutocomplete(NEWPASSWORDAGAIN, NEWPASSWORDAGAIN, |
75 | 90 | null); |
76 | 91 | newPassAgain.setWrapTitle(false); |
@@ -152,7 +167,7 @@ else if (ret == 3) { |
152 | 167 | } |
153 | 168 | }); |
154 | 169 | } |
155 | | - |
| 170 | + |
156 | 171 | @Override |
157 | 172 | public boolean equals(Object other) { |
158 | 173 | return super.equals(other); |
|
0 commit comments