Re: Validate before convert

2017-10-19 Thread Sven Meier

Hi,

you can do your md5-hashing in a model wrapper instead:

  public class Md5Model implements IModel {
    private IModel model;
    public Md5Model(IModel model) {
  this.model = model;
    }
    public String getObject() {
  return null;
    }
    public void setObject(String string) {
  model.setObject(md5(string));
    }
  }

Have fun
Sven


Am 19.10.2017 um 15:03 schrieb Sandor Feher:

Hi,

I have a form used for changing users' data e.g, mail address, password and
so one. I have a custom converter to convert clear text password to md5 hash
on the fly.
I set up some validators for password (length, complexity..) but the problem
is that the validator fires only after the input value get converted.

If I check the input within isModelChanged() then it works fine but I try to
avoid such solutions if possible.



   PasswordTextField pwd1 = new PasswordTextField("password") {

 @Override
 public  IConverter getConverter(Class type) {
 return (IConverter) new Md5Converter() {

 @Override
 public Boolean isModelChanged() {
 return u.getPassword() == null ||
!u.getPassword().equals(getInput());
 }

 };
 }

 };



TIA, Sandor

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Validate before convert

2017-10-19 Thread Sandor Feher
Hi,

I have a form used for changing users' data e.g, mail address, password and
so one. I have a custom converter to convert clear text password to md5 hash
on the fly.
I set up some validators for password (length, complexity..) but the problem
is that the validator fires only after the input value get converted.

If I check the input within isModelChanged() then it works fine but I try to
avoid such solutions if possible.



  PasswordTextField pwd1 = new PasswordTextField("password") {

@Override
public  IConverter getConverter(Class type) {
return (IConverter) new Md5Converter() {

@Override
public Boolean isModelChanged() {
return u.getPassword() == null ||
!u.getPassword().equals(getInput());
}

};
}

};



TIA, Sandor

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Code Generator with Wicket...

2017-10-19 Thread Vit Rozkovec

Awesome, PR welcomed.

Cheers.

On 10/18/2017 11:29 AM, badgers wrote:

Yes!

I will check it. When I did my adaptions I will do a pull request.

Thx in advance

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org