sub save_preferences {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form, $webdav) = @_;
+ my ($self, $myconfig, $form) = @_;
my $dbh = $form->get_standard_dbh($myconfig);
my $auth = $main::auth;
- if ($auth->can_change_password()
- && defined $form->{new_password}
- && ($form->{new_password} ne '********')) {
- $auth->change_password($form->{login}, $form->{new_password});
-
- $form->{password} = $form->{new_password};
- $auth->set_session_value('password', $form->{password});
- $auth->create_or_refresh_session();
- }
-
$main::lxdebug->leave_sub();
return $rc;
use utf8;
use SL::Auth;
+use SL::Auth::PasswordPolicy;
use SL::AM;
use SL::CA;
use SL::Form;
TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } });
- $form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, 0));
+ if (AM->save_preferences(\%myconfig, $form)) {
+ if ($::auth->can_change_password()
+ && defined $form->{new_password}
+ && ($form->{new_password} ne '********')) {
+ my $verifier = SL::Auth::PasswordPolicy->new;
+ my $result = $verifier->verify($form->{new_password});
+
+ if ($result != SL::Auth::PasswordPolicy->OK()) {
+ $form->error($::locale->text('The settings were saved, but the password was not changed.') . ' ' . join(' ', $verifier->errors($result)));
+ }
+
+ $::auth->change_password($form->{login}, $form->{new_password});
+
+ $form->{password} = $form->{new_password};
+ $::auth->set_session_value('password', $form->{password});
+ $::auth->create_or_refresh_session();
+ }
+
+ $form->redirect($locale->text('Preferences saved!'));
+ }
+
$form->error($locale->text('Cannot save preferences!'));
$main::lxdebug->leave_sub();
'The selected warehouse does not exist.' => 'Das ausgewählte Lager existiert nicht.',
'The selected warehouse is empty.' => 'Das ausgewählte Lager ist leer.',
'The session is invalid or has expired.' => 'Sie sind von Lx-Office abgemeldet.',
+ 'The settings were saved, but the password was not changed.' => 'Die Einstellungen wurden gespeichert, aber das Passwort wurde nicht geändert.',
'The source warehouse does not contain any bins.' => 'Das Quelllager enthält keine Lagerplätze.',
'The start date is missing.' => 'Das Startdatum fehlt.',
'The subject is missing.' => 'Der Betreff fehlt.',