From 439ebb1128b39105f2e223d3d5f64628f512aa38 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 25 Apr 2012 12:50:21 +0200 Subject: [PATCH] CC-3667 : Preferences pages should have an option to enable/disable password recovery option --- .../application/forms/GeneralPreferences.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index aae6cc7b5..fd61cf957 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -84,16 +84,23 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ->setFilters(array('StringTrim')) ->setValidators(array( 'NotEmpty', - 'EmailAddress', - new Zend_Validate_Callback(function ($value, $context) { - if ($context['enableSystemEmail']) { - return true; - } - - return false; - }) - )) - ->setDecorators(array('ViewHelper')); + 'EmailAddress' + )) + ->setDecorators(array('ViewHelper')); + + $systemEmail->addValidator('Callback', true, array( + 'callback' => function($value, $context) { + if ($context['enableSystemEmail']) { + return true; + } + return false; + }, + 'messages' => array( + Zend_Validate_Callback::INVALID_VALUE => 'Email must be enabled' + ), + )); + + $this->addElement($systemEmail); }