sintonia/airtime_mvc/application/validate/NotDemoValidate.php
Albert Santoni 11ae76beb8 Fix SAAS-349 by preventing password changes in demo mode.
* Added a NotDemoValidate validator class to ensure no changes to a field in demo mode.
* Prevent the user from changing the password of any user in demo mode.
* Fixes SAAS-349.
2013-09-26 16:23:22 -04:00

24 lines
536 B
PHP

<?php
class Application_Validate_NotDemoValidate extends Zend_Validate_Abstract
{
const NOTDEMO = 'notdemo';
protected $_messageTemplates = array(
self::NOTDEMO => "Cannot be changed in demo mode"
);
public function isValid($value)
{
$this->_setValue($value);
$CC_CONFIG = Config::getConfig();
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
$this->_error(self::NOTDEMO);
return false;
} else {
return true;
}
}
}