From e26744d625def65bae0164ef792cf52a81d6bb8d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 15 Apr 2025 13:38:59 +0200 Subject: [PATCH] Move code for showEyeForField into a dedicated function. --- htdocs/core/lib/security2.lib.php | 33 +++++++++++++++++++++++++++++++ htdocs/core/tpl/login.tpl.php | 25 ++++------------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index a131afa1c9b..d17b4348c55 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -589,3 +589,36 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token return $out; } + +/** + * Output the eye picto to show/hide a password HTML field. + * + * @param string $htmlname HTML name of element to insert key into + * @param string $htmlnameofinput HTML id of input field + * @return string HTML javascript code to set a password + */ +function showEyeForField($htmlname, $htmlnameofinput) +{ + return ' + +'; +} diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c2ef622e722..e87222f9b4c 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -306,28 +306,11 @@ if ($disablenofollow) { " name="password" class="flat input-icon-password minwidth150" value="" tabindex="2" autocomplete="" /> - + -