diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php
index ce36d97d06a..e3f2c7307f7 100644
--- a/htdocs/admin/agenda_xcal.php
+++ b/htdocs/admin/agenda_xcal.php
@@ -207,21 +207,11 @@ $message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'
';
print info_admin($message);
-if (!empty($conf->use_javascript_ajax)) {
- print "\n".'';
-}
+$constname = 'MAIN_AGENDA_XCAL_EXPORTKEY';
+
+// Add button to autosuggest a key
+include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+print dolJSToSetRandomPassword($constname);
// End of page
llxFooter();
diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index a8d33ae5a09..8f98b4d25e9 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -188,22 +188,10 @@ if (!empty($conf->global->CLICKTODIAL_URL)) {
}
}
-if (!empty($conf->use_javascript_ajax)) {
- print "\n".'';
-}
+// Add button to autosuggest a key
+include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+print dolJSToSetRandomPassword('CLICKTODIAL_KEY_FOR_CIDLOOKUP');
+
// End of page
llxFooter();
diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php
index ee6c2ae6b52..05df4187130 100644
--- a/htdocs/admin/eventorganization.php
+++ b/htdocs/admin/eventorganization.php
@@ -273,21 +273,10 @@ if ($action == 'edit') {
if (!empty($conf->use_javascript_ajax)) {
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
- if (!empty($conf->use_javascript_ajax)) {
- print "\n".'';
- }
+
+ // Add button to autosuggest a key
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+ print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
} elseif ($val['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php
index b1b74189d35..cfe40c006b7 100644
--- a/htdocs/admin/hrm.php
+++ b/htdocs/admin/hrm.php
@@ -540,21 +540,10 @@ if ($action == 'edit') {
if (!empty($conf->use_javascript_ajax)) {
print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
- if (!empty($conf->use_javascript_ajax)) {
- print "\n".'';
- }
+
+ // Add button to autosuggest a key
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+ print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
} elseif ($val['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php
index 37735a43ed3..da2df89b21a 100644
--- a/htdocs/admin/mailing.php
+++ b/htdocs/admin/mailing.php
@@ -107,21 +107,11 @@ llxHeader('', $langs->trans("MailingSetup"));
$linkback = ''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("MailingSetup"), $linkback, 'title_setup');
-if (!empty($conf->use_javascript_ajax)) {
- print "\n".'';
-}
+$constname = 'MAILING_EMAIL_UNSUBSCRIBE_KEY';
+
+// Add button to autosuggest a key
+include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+print dolJSToSetRandomPassword($constname);
print '
';
print '
| '; + print ' | |||
| '; print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code'); print ' | |||
| '; + print ' | |||
| ';
if ($caneditfield && !$object->ldap_sid) {
print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code');
} elseif ($object->civility_code) {
@@ -2834,20 +2834,12 @@ if ($action == 'create' || $action == 'adduserldap') {
}
}
-if (!empty($conf->api->enabled) && !empty($conf->use_javascript_ajax)) {
- print "\n".'';
+if (!empty($conf->api->enabled)) {
+ $constname = 'api_key';
+
+ // Add button to autosuggest a key
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
+ print dolJSToSetRandomPassword($constname, 'generate_api_key');
}
// End of page
diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php
index 14af2e88b3f..8ae62d1bf3c 100644
--- a/htdocs/webservices/admin/index.php
+++ b/htdocs/webservices/admin/index.php
@@ -140,21 +140,10 @@ print ' '; print ' '; print $langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php'); -if (!empty($conf->use_javascript_ajax)) { - print "\n".''; -} +$constname = 'WEBSERVICES_KEY'; + +print dolJSToSetRandomPassword($constname); + // End of page llxFooter(); | |||