Why is this filter here? Should it be in the controller?

I saw this code. I deleted some unnecessary code to make it simpler (for example, an identical validator that checks for passwords).

$password = new Zend_Form_Element_Password('password');
$password->addFilter(new My_Filters_Sha());

$password2 = new Zend_Form_Element_Password('password2');
$password2->addFilter(new My_Filters_Sha());

My question is about the filter. I assume that the one who wrote it saves the password in the database as a hash, and therefore it hash a password with a filter. But what's the point of having a hash filter? Shouldn't this be done once in the controller when creating the account? When the input is received, process it with a hash and save it. Does it make sense to do this as a filter?

+3
source share
1 answer

, . - -. - , . Form Model , , .

+2

Source: https://habr.com/ru/post/1787221/


All Articles