Hi,

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

  public class Md5Model implements IModel<String> {
    private IModel<String> model;
    public Md5Model(IModel<String> 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.


<code>
   PasswordTextField pwd1 = new PasswordTextField("password") {

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

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

                 };
             }

         };
</code>


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

Reply via email to