From a3fda90a85f6b65b6193218ee47689f7342c39cc Mon Sep 17 00:00:00 2001
From: Brian Read
Date: Mon, 28 Jul 2025 16:43:41 +0100
Subject: [PATCH] * Mon Jul 28 2025 Brian Read
11.0.0-111.sme - Add password strength details to passowrd panels [SME:
13081]
---
.../lib/SrvMngr/Controller/Useraccounts.pm | 14 ++++++++++++++
.../lib/SrvMngr/Controller/Userpassword.pm | 12 ++++++++++++
.../I18N/Modules/Useraccounts/useraccounts_en.lex | 5 +++++
.../I18N/Modules/Userpassword/userpassword_en.lex | 7 +++++--
.../default/templates/partials/_usr_pwd.html.ep | 8 ++++++++
.../default/templates/partials/_usr_pwds.html.ep | 8 ++++++++
.../themes/default/templates/userpassword.html.ep | 4 +++-
smeserver-manager.spec | 5 ++++-
8 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm
index 16712b4..103dc44 100644
--- a/root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm
+++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Useraccounts.pm
@@ -120,6 +120,20 @@ sub do_display {
}
$c->stash(useraccounts => \@useraccounts);
} ## end if ($trt eq 'LIST')
+
+ my $cdb = esmith::ConfigDB::UTF8->open_ro || die "Couldn't open configuration db";
+ my $rec = $cdb->get('passwordstrength');
+ $usr_datas{passwdlength} = ($rec ? ($rec->prop('length') || 12) : 12);
+ if ($trt eq 'PWS'){
+ $usr_datas{passwdstrength} = ($rec ? ($rec->prop('Admin') || 'none') : 'none');
+ } else {
+ $usr_datas{passwdstrength} = ($rec ? ($rec->prop('Users') || 'none') : 'none');
+ }
+
+ if ( !(defined $usr_datas{passwdstrength} && $usr_datas{passwdstrength} =~ /^(none|normal|intermediate|strong)$/)) {
+ $usr_datas{passwdstrength} = 'strong';
+ }
+
$c->stash(title => $title, notif => $notif, usr_datas => \%usr_datas);
$c->render(template => 'useraccounts');
} ## end sub do_display
diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm
index f565e18..95568d8 100644
--- a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm
+++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpassword.pm
@@ -50,6 +50,18 @@ sub main {
$pwd_datas{jwt} = $jwt;
$c->flash(success => $c->l('pwd_OK_FOR_RESET'));
} ## end else [ if ($c->is_logged_in) ]
+
+ my $cdb = esmith::ConfigDB::UTF8->open_ro || die "Couldn't open configuration db";
+ my $rec = $cdb->get('passwordstrength');
+ $pwd_datas{passwdlength} = ($rec ? ($rec->prop('length') || 12) : 12);
+ if ($c->is_admin){
+ $pwd_datas{passwdstrength} = ($rec ? ($rec->prop('Admin') || 'none') : 'none');
+ } else {
+ $pwd_datas{passwdstrength} = ($rec ? ($rec->prop('Users') || 'none') : 'none');
+ }
+ if ( !(defined $pwd_datas{passwdstrength} && $pwd_datas{passwdstrength} =~ /^(none|normal|intermediate|strong)$/)) {
+ $pwd_datas{passwdstrength} = 'strong';
+ }
$c->stash(pwd_datas => \%pwd_datas);
$c->render('userpassword');
} ## end sub main
diff --git a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Useraccounts/useraccounts_en.lex b/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Useraccounts/useraccounts_en.lex
index 54c71bf..2af84f7 100644
--- a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Useraccounts/useraccounts_en.lex
+++ b/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Useraccounts/useraccounts_en.lex
@@ -60,3 +60,8 @@
'usr_NEW_SYSTEM_PASSWORD_VERIFY' => 'New system password (verify)',
'usr_LABEL_IPSECRW_DOWNLOAD' => 'Download digital certificate to IPSec client',
'usr_ERR_OCCURRED_DELETING' => 'An error occurred while trying to delete the user.',
+'usr_NONE_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters.',
+'usr_NORMAL_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters.',
+'usr_INTERMEDIATE_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters and must pass a dictionary check.',
+'usr_STRONG_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters, numbers and special characters and must pass a dictionary check.',
+'usr_PASSWORD_WIKI' => "If you want to know more about passwords, then please refer to the Wiki",
\ No newline at end of file
diff --git a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Userpassword/userpassword_en.lex b/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Userpassword/userpassword_en.lex
index 299a0af..433f7d7 100644
--- a/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Userpassword/userpassword_en.lex
+++ b/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Userpassword/userpassword_en.lex
@@ -19,5 +19,8 @@
'pwd_PASSWORD_CHANGE_SUCCESS' => 'Your password has been successfully changed.',
'pwd_DESCRIPTION' => 'To change your account password, please fill out the following form. You will need to provide the name of your account, your old password, and your desired new password. (You must type the new password twice.)
If you cannot change your password because you have forgotten the old one, your local system administrator can reset your password using the server manager.
',
'pwd_DESCRIPTION_RESET' => 'To reset your account password, please fill out the following form. You will need to provide your desired new password. (You must type it twice.)
In cas of problem, your local system administrator can reset your password using the server manager.
',
-'pwd_PASSWORD_DESCRIPTION' => 'The password must be composed of at least twelve characters with uppercase and lowercase letters, numbers and non-alphanumeric characters.',
-'pwd_PASSWORD_WIKI' => "If you want to know more about passwords, then please refer to the Wiki",
\ No newline at end of file
+'pwd_NONE_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters.',
+'pwd_NORMAL_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters.',
+'pwd_INTERMEDIATE_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters and must pass a dictionary check.',
+'pwd_STRONG_PASSWORD_DESCRIPTION' => 'The password must be composed of at least [_1] characters with uppercase and lowercase letters, numbers and special characters and must pass a dictionary check.',
+'pwd_PASSWORD_WIKI' => "If you want to know more about passwords, then please refer to the Wiki",
\ No newline at end of file
diff --git a/root/usr/share/smanager/themes/default/templates/partials/_usr_pwd.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_usr_pwd.html.ep
index 35a1c7b..4b8e125 100644
--- a/root/usr/share/smanager/themes/default/templates/partials/_usr_pwd.html.ep
+++ b/root/usr/share/smanager/themes/default/templates/partials/_usr_pwd.html.ep
@@ -13,6 +13,14 @@
%= l 'usr_RESET_DESC2'
+
+
+ % my $strength = uc($usr_datas->{passwdstrength});
+ <%= $c->render_to_string( inline => l('usr_'.$strength.'_PASSWORD_DESCRIPTION',$usr_datas->{passwdlength})) %>
+
+ <%= $c->render_to_string( inline => l('usr_PASSWORD_WIKI')) %>
+
+
diff --git a/root/usr/share/smanager/themes/default/templates/partials/_usr_pwds.html.ep b/root/usr/share/smanager/themes/default/templates/partials/_usr_pwds.html.ep
index 007bc91..d12893a 100644
--- a/root/usr/share/smanager/themes/default/templates/partials/_usr_pwds.html.ep
+++ b/root/usr/share/smanager/themes/default/templates/partials/_usr_pwds.html.ep
@@ -6,6 +6,14 @@
%= l 'usr_SYSTEM_PASSWORD_DESCRIPTION'
+
+
+ % my $strength = uc($usr_datas->{passwdstrength});
+ <%= $c->render_to_string( inline => l('usr_'.$strength.'_PASSWORD_DESCRIPTION',$usr_datas->{passwdlength})) %>
+
+ <%= $c->render_to_string( inline => l('usr_PASSWORD_WIKI')) %>
+
+
diff --git a/root/usr/share/smanager/themes/default/templates/userpassword.html.ep b/root/usr/share/smanager/themes/default/templates/userpassword.html.ep
index 946db50..bb5a5ef 100644
--- a/root/usr/share/smanager/themes/default/templates/userpassword.html.ep
+++ b/root/usr/share/smanager/themes/default/templates/userpassword.html.ep
@@ -27,7 +27,9 @@
%= $c->render_to_string( inline => l('pwd_DESCRIPTION'));
- <%= $c->render_to_string( inline => l('pwd_PASSWORD_DESCRIPTION')) %>
+ % my $strength = uc($pwd_datas->{passwdstrength});
+ <%= $c->render_to_string( inline => l('pwd_'.$strength.'_PASSWORD_DESCRIPTION',$pwd_datas->{passwdlength})) %>
+
<%= $c->render_to_string( inline => l('pwd_PASSWORD_WIKI')) %>
diff --git a/smeserver-manager.spec b/smeserver-manager.spec
index be52e17..87941bb 100644
--- a/smeserver-manager.spec
+++ b/smeserver-manager.spec
@@ -2,7 +2,7 @@ Summary: Sme server navigation module : manager 2
%define name smeserver-manager
Name: %{name}
%define version 11.0.0
-%define release 110
+%define release 111
Version: %{version}
Release: %{release}%{?dist}
License: GPL
@@ -146,6 +146,9 @@ true
%defattr(-,root,root)
%changelog
+* Mon Jul 28 2025 Brian Read 11.0.0-111.sme
+- Add password strength details to passowrd panels [SME: 13081]
+
* Sat Jul 26 2025 Brian Read 11.0.0-110.sme
- Get cifs workstation backup restore to show backup sets [SME: 12645]
Add lex file for roundcubepanel to provide lex environment for lex strings