2
0
forked from Wavyzz/dolibarr

NEW Add picto property on sub-module for paswword generation

This commit is contained in:
Laurent Destailleur
2022-09-11 12:18:43 +02:00
parent cc4bb9b40f
commit 2293d82607
8 changed files with 62 additions and 11 deletions

View File

@@ -216,6 +216,8 @@ print '<td>'.$langs->trans("Example").'</td>';
print '<td class="center">'.$langs->trans("Activated").'</td>';
print '</tr>';
$tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN'));
foreach ($arrayhandler as $key => $module) {
// Show modules according to features level
if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
@@ -226,15 +228,16 @@ foreach ($arrayhandler as $key => $module) {
}
if ($module->isEnabled()) {
print '<tr class="oddeven"><td width="100">';
print '<tr class="oddeven"><td>';
print img_picto('', $module->picto, 'class="width25 size15x opacitymedium"').' ';
print ucfirst($key);
print "</td><td>\n";
print $module->getDescription().'<br>';
print $langs->trans("MinLength").': '.$module->length;
print $langs->trans("MinLength").': <span class="opacitymedium">'.$module->length.'</span>';
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
print '<td class="nowraponall">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors");
@@ -246,7 +249,7 @@ foreach ($arrayhandler as $key => $module) {
}
print '</td>'."\n";
print '<td width="100" align="center">';
print '<td class="center">';
if ($conf->global->USER_PASSWORD_GENERATED == $key) {
//print img_picto('', 'tick');
print img_picto($langs->trans("Enabled"), 'switch_on');
@@ -267,7 +270,6 @@ print '</form>';
//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
// Patter for Password Perso
if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
print '<br>';
print '<div class="div-table-responsive-no-min">';
@@ -346,7 +348,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
print ' }';
print ' function generatelink(){';
print ' return "security.php?action=updatepattern&pattern="+getStringArg();';
print ' return "security.php?action=updatepattern&token='.newToken().'&pattern="+getStringArg();';
print ' }';
print ' function valuePatternChange(){';
@@ -470,7 +472,9 @@ print '</tr>';
print '</table>';
print '</form>';
print '<br>';
if (GETPOST('info', 'int') > 0) {

View File

@@ -113,7 +113,7 @@ print '<br>';
// Upload options
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent nomarginbottom">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';
print '<td>'.$langs->trans("Value").'</td>';

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013-2019 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2022 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -312,11 +312,48 @@ print yn(empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) ? 0 : 1);
print '<br>';
print '<br>';
print '<strong>'.$langs->trans("DoNotStoreClearPassword").'</strong>: ';
print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);
if (empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
}
print '<br>';
print '<br>';
/* Already into section conf file */
/*
$usepassinconfencrypted = 0;
global $dolibarr_main_db_pass, $dolibarr_main_db_encrypted_pass;
if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
$usepassinconfencrypted = 1;
}
print '<strong>'.$langs->trans("MainDbPasswordFileConfEncrypted").'</strong>: ';
print $usepassinconfencrypted ? img_picto('', 'tick').' ' : img_warning().' ';
print yn($usepassinconfencrypted);
if (empty($usepassinconfencrypted)) {
print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
}
print '<br>';
print '<br>';
*/
print '<strong>'.$langs->trans("PasswordLength").'</strong>: ';
print empty($conf->global->DATABASE_PWD_ENCRYPTED) ? '' : img_picto('', 'tick').' ';
print yn(empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1);
if (empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
print ' <span class="opacitymedium">('.$langs->trans("Recommended").' '.yn(1).')</span>';
}
print '<br>';
print '<br>';
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? img_warning().' ' : img_picto('', 'tick').' ';
print yn(empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 0 : 1);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
if (empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' - <span class="opacitymedium">'.$langs->trans("Recommended").': '.$langs->trans("DefinedAPathForAntivirusCommandIntoSetup", $langs->transnoentitiesnoconv("Home")." - ".$langs->transcountrynoentities("Setup")." - ".$langs->transnoentitiesnoconv("Security")).'</span>';
} else {
print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;
if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) {
print ' - <span class="opacitymedium">'.$langs->trans("ValueIsForcedBySystem").'</span>';
@@ -325,6 +362,7 @@ if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print '<br>';
print '<br>';
$securityevent = new Events($db);
$eventstolog = $securityevent->eventstolog;

View File

@@ -35,6 +35,8 @@ class modGeneratePassNone extends ModeleGenPassword
*/
public $id;
public $picto = 'fa-keyboard';
/**
* Minimum length (text visible by end user)
*

View File

@@ -37,6 +37,8 @@ class modGeneratePassPerso extends ModeleGenPassword
*/
public $id;
public $picto = 'fa-shield-alt';
/**
* Minimum length (text visible by end user)
*

View File

@@ -35,6 +35,8 @@ class modGeneratePassStandard extends ModeleGenPassword
*/
public $id;
public $picto = 'fa-shield-alt';
/**
* Minimum length (text visible by end user)
*

View File

@@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
*/
abstract class ModeleGenPassword
{
public $picto = 'generic';
/**
* Flag to 1 if we must clean ambiguous charaters for the autogeneration of password (List of ambiguous char is in $this->Ambi)
*

View File

@@ -2310,3 +2310,4 @@ Images=Images
MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form
ScriptIsEmpty=The script is empty
ShowHideTheNRequests=Show/hide the %s SQL request(s)
DefinedAPathForAntivirusCommandIntoSetup=Define a path for an antivirus program into <b>%s</b>