ItEr40S10CUAltaUsuarioItEr39S10: added a password confirmation box in the user edition page.
The password confirmation box has a constraint to be equal to the content of the main password box.
This commit is contained in:
parent
06806d3d06
commit
ca83d2bfb4
2 changed files with 23 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ import org.navalplanner.web.common.OnlyOneVisible;
|
|||
import org.navalplanner.web.common.Util;
|
||||
import org.navalplanner.web.common.components.Autocomplete;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
|
|
@ -210,6 +211,22 @@ public class UserCRUDController extends GenericForwardComposer implements
|
|||
*/
|
||||
public void setPassword(String password) {
|
||||
userModel.setPassword(password);
|
||||
//update the constraint on the confirmation password box
|
||||
((Textbox)createWindow.getFellowIfAny("passwordConfirmation")).
|
||||
clearErrorMessage(true);
|
||||
}
|
||||
|
||||
public Constraint validatePasswordConfirmation() {
|
||||
return new Constraint() {
|
||||
@Override
|
||||
public void validate(Component comp, Object value)
|
||||
throws WrongValueException {
|
||||
((Textbox)comp).setRawValue(value);
|
||||
if(!((String)value).equals(passwordBox.getValue())) {
|
||||
throw new WrongValueException(comp, _("passwords don't match"));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private OnlyOneVisible getVisibility() {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,12 @@
|
|||
<textbox id="password" type="password"
|
||||
onChange="controller.setPassword(self.value);" width="300px"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Password confirmation')}:" />
|
||||
<textbox id="passwordConfirmation" type="password"
|
||||
constraint="@{controller.validatePasswordConfirmation}"
|
||||
width="300px"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Disabled')}:" />
|
||||
<checkbox id="disabled"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue