From: Moritz Bunkus Date: Tue, 18 Jan 2011 15:31:51 +0000 (+0100) Subject: Überprüfung der Passwortrichtlinie, wenn die Benutzerin ihr Passwort ändert X-Git-Tag: release-2.6.3~61^2~7^2~1^2~15 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f07df483ee9e755f29fe599424a1ba2ed8bcc6b8;p=kivitendo-erp.git Überprüfung der Passwortrichtlinie, wenn die Benutzerin ihr Passwort ändert --- diff --git a/SL/AM.pm b/SL/AM.pm index df7d9d2c0..e6101b402 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1410,7 +1410,7 @@ sub save_defaults { sub save_preferences { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $webdav) = @_; + my ($self, $myconfig, $form) = @_; my $dbh = $form->get_standard_dbh($myconfig); @@ -1438,16 +1438,6 @@ sub save_preferences { 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; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index b7c980c9e..66874c736 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -34,6 +34,7 @@ use utf8; use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::AM; use SL::CA; use SL::Form; @@ -2549,7 +2550,27 @@ sub save_preferences { 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(); diff --git a/locale/de/all b/locale/de/all index 00d74fdbb..4951e6de8 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1704,6 +1704,7 @@ $self->{texts} = { '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.',