/** * Filter password * * @param string $value */ public function filterPassword(&$value) { $value = User::getHashPassword($value); if ($value === false) { return $this->trans('user.entity.user.error_password_min', ['#MIN#' => 6]); } }
/** * Filter password * * @param string $value */ public function validateNew(&$value) { $value = User::getHashPassword($value); if ($value === false) { return $this->trans('user.form.password.error_password_min', ['#MIN#' => 6]); } }
/** * Check old password * * @param string $value */ public function validatePassword(&$value) { if ($this->user !== null) { $hash = User::getHashPasswordByUserID($this->user->id); if ($hash === false) { return $this->trans('user.form.access_form.bad_password'); } $value = User::getHashPassword($value); if (!User::checkPasswordByHash($value, $hash)) { return $this->trans('user.form.access_form.bad_password'); } } }