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.
This commit is contained in:
parent
c8bb12ca45
commit
11ae76beb8
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once( __DIR__ . '/../validate/NotDemoValidate.php');
|
||||||
|
|
||||||
class Application_Form_AddUser extends Zend_Form
|
class Application_Form_AddUser extends Zend_Form
|
||||||
{
|
{
|
||||||
|
@ -12,7 +13,8 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
* */
|
* */
|
||||||
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
|
||||||
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
|
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
|
||||||
|
$notDemoValidator = new Application_Validate_NotDemoValidate();
|
||||||
|
|
||||||
$this->setAttrib('id', 'user_form');
|
$this->setAttrib('id', 'user_form');
|
||||||
|
|
||||||
$hidden = new Zend_Form_Element_Hidden('user_id');
|
$hidden = new Zend_Form_Element_Hidden('user_id');
|
||||||
|
@ -42,6 +44,7 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$passwordVerify->setRequired(true);
|
$passwordVerify->setRequired(true);
|
||||||
$passwordVerify->addFilter('StringTrim');
|
$passwordVerify->addFilter('StringTrim');
|
||||||
$passwordVerify->addValidator($notEmptyValidator);
|
$passwordVerify->addValidator($notEmptyValidator);
|
||||||
|
$passwordVerify->addValidator($notDemoValidator);
|
||||||
$this->addElement($passwordVerify);
|
$this->addElement($passwordVerify);
|
||||||
|
|
||||||
$firstName = new Zend_Form_Element_Text('first_name');
|
$firstName = new Zend_Form_Element_Text('first_name');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once( __DIR__ . '/../validate/NotDemoValidate.php');
|
||||||
|
|
||||||
class Application_Form_EditUser extends Zend_Form
|
class Application_Form_EditUser extends Zend_Form
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,14 +10,14 @@ class Application_Validate_NotDemoValidate extends Zend_Validate_Abstract
|
||||||
|
|
||||||
public function isValid($value)
|
public function isValid($value)
|
||||||
{
|
{
|
||||||
$this->_setValue($value);
|
$this->_setValue($value);
|
||||||
|
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
||||||
$this->_error(self::NOTDEMO);
|
$this->_error(self::NOTDEMO);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
e7Y4a8H6
|
|
Loading…
Reference in New Issue