Password field edit action

I'm currently making a crud for managing users, I'm validating the password/password repeat fields upon creation. However on the edit screen I would want these fields to be emtpy and allowed to be empty and only overwrite the password fields or validate them when the user fills them in, thus setting a new password.

Does anyone know a working example of this functionality or how to achieve this: - load form fields (set) empty - ByPass validation if empty (not just edit) - Don't overwrite the record upon saving if its empty, but do overwrite re validate if filled

To post all involved code will be lenghty so here is a link to the souce on bitbucket: https://bitbucket.org/Meint-Willem/phalcon-time/src/ (work in progress)

Thanks in advance for any help

edited 9d ago
  1. Load model from database
  2. Use password element so it won't set the input to password as hash
  3. If password was changed(so user provided new password) then add validators and validate it
  4. After validation if password was changed but before save change this password to hash

?



1.2k
  1. Load model from database
  2. Use password element so it won't set the input to password as hash
  3. If password was changed(so user provided new password) then add validators and validate it
  4. After validation if password was changed but before save change this password to hash

?

Updated the code but struggling with getting the validation to work: https://bitbucket.org/Meint-Willem/phalcon-time/commits/066e7996c648c27b1a029c2a415f260b293fc74c?at=master

I saw other people just use two different forms but there should be something more simple for this.