Skip to content
Snippets Groups Projects
Commit 4042a1ae authored by Uma's avatar Uma
Browse files

Password regex for validation has been centralized

parent d48fd37b
No related branches found
No related tags found
3 merge requests!802Field Mapping ID fix,!793#1533 issue on date formate,!776Password validation regex centralized
...@@ -20,4 +20,4 @@ $max_mailboxes = 3; ...@@ -20,4 +20,4 @@ $max_mailboxes = 3;
$runtime_connectors = array(); $runtime_connectors = array();
//Password Regex for validation //Password Regex for validation
$password_regex = '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})'; $validation_regex = array('password_regex' => '^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})');
\ No newline at end of file \ No newline at end of file
...@@ -76,7 +76,7 @@ function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword, ...@@ -76,7 +76,7 @@ function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword,
function isPasswordStrong($new_password){ function isPasswordStrong($new_password){
$runtime_configs = Vtiger_Runtime_Configs::getInstance(); $runtime_configs = Vtiger_Runtime_Configs::getInstance();
$password_regex = $runtime_configs->get('password_regex'); $password_regex = $runtime_configs->getValidationRegex('password_regex');
if (preg_match('/'.$password_regex.'/i', $new_password) == 1) { if (preg_match('/'.$password_regex.'/i', $new_password) == 1) {
return true; return true;
} }
......
...@@ -45,10 +45,12 @@ ...@@ -45,10 +45,12 @@
/** /**
* Function to fetch the value for given key * Function to fetch the value for given key
*/ */
public function get($key, $default = '') { public function getValidationRegex($key, $default = '') {
global $validation_regex;
$value = ''; $value = '';
if(isset($GLOBALS[$key])) { if(isset($validation_regex[$key])) {
$value = $GLOBALS[$key]; $value = $validation_regex[$key];
} }
if(empty($value) && !empty($default)) { if(empty($value) && !empty($default)) {
......
...@@ -113,7 +113,7 @@ class Install_Index_view extends Vtiger_View_Controller { ...@@ -113,7 +113,7 @@ class Install_Index_view extends Vtiger_View_Controller {
$viewer->assign('ADMIN_EMAIL', $defaultParameters['admin_email']); $viewer->assign('ADMIN_EMAIL', $defaultParameters['admin_email']);
$runtime_configs = Vtiger_Runtime_Configs::getInstance(); $runtime_configs = Vtiger_Runtime_Configs::getInstance();
$password_regex = $runtime_configs->get('password_regex'); $password_regex = $runtime_configs->getValidationRegex('password_regex');
$viewer->assign('PWD_REGEX', $password_regex); $viewer->assign('PWD_REGEX', $password_regex);
$viewer->view('Step4.tpl', $moduleName); $viewer->view('Step4.tpl', $moduleName);
......
...@@ -169,7 +169,7 @@ class Users_List_View extends Settings_Vtiger_List_View { ...@@ -169,7 +169,7 @@ class Users_List_View extends Settings_Vtiger_List_View {
$viewer->assign('SEARCH_DETAILS', $searchParams); $viewer->assign('SEARCH_DETAILS', $searchParams);
$runtime_configs = Vtiger_Runtime_Configs::getInstance(); $runtime_configs = Vtiger_Runtime_Configs::getInstance();
$password_regex = $runtime_configs->get('password_regex'); $password_regex = $runtime_configs->getValidationRegex('password_regex');
$viewer->assign('PWD_REGEX', $password_regex); $viewer->assign('PWD_REGEX', $password_regex);
} }
......
...@@ -173,7 +173,7 @@ class Users_PreferenceDetail_View extends Vtiger_Detail_View { ...@@ -173,7 +173,7 @@ class Users_PreferenceDetail_View extends Vtiger_Detail_View {
$viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails()); $viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails());
$runtime_configs = Vtiger_Runtime_Configs::getInstance(); $runtime_configs = Vtiger_Runtime_Configs::getInstance();
$password_regex = $runtime_configs->get('password_regex'); $password_regex = $runtime_configs->getValidationRegex('password_regex');
$viewer->assign('PWD_REGEX', $password_regex); $viewer->assign('PWD_REGEX', $password_regex);
return parent::process($request); return parent::process($request);
} }
......
...@@ -152,7 +152,7 @@ Class Users_PreferenceEdit_View extends Vtiger_Edit_View { ...@@ -152,7 +152,7 @@ Class Users_PreferenceEdit_View extends Vtiger_Edit_View {
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$runtime_configs = Vtiger_Runtime_Configs::getInstance(); $runtime_configs = Vtiger_Runtime_Configs::getInstance();
$password_regex = $runtime_configs->get('password_regex'); $password_regex = $runtime_configs->getValidationRegex('password_regex');
$viewer->assign('PWD_REGEX', $password_regex); $viewer->assign('PWD_REGEX', $password_regex);
parent::process($request); parent::process($request);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment