diff --git a/CHANGELOG b/CHANGELOG index 5f6b5331a..786cc3fa4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail - Add missing sql upgrade file for 'ip' column resize in session table (#5465) - Do not show inline images of unsupported mimetype (#5463) - Password: Added LDAP PPolicy driver (#5364) +- Password: Added possibility to nicely redirect from other plugins on password expiration (#5468) - Implement separate action to mark all messages in a folder as \Seen (#5006) - Implement marking as \Seen in all folders or in a folder and its subfolders (#5076) - Archive: Don't reload messages list when it's not needed (#5225) diff --git a/plugins/password/composer.json b/plugins/password/composer.json index 8c6848ca7..3cc0c397f 100644 --- a/plugins/password/composer.json +++ b/plugins/password/composer.json @@ -3,7 +3,7 @@ "type": "roundcube-plugin", "description": "Password Change for Roundcube. Plugin adds a possibility to change user password using many methods (drivers) via Settings/Password tab.", "license": "GPLv3+", - "version": "4.1", + "version": "4.2", "authors": [ { "name": "Aleksander Machniak", diff --git a/plugins/password/localization/en_GB.inc b/plugins/password/localization/en_GB.inc index 644bb7dd6..ddd0c52de 100644 --- a/plugins/password/localization/en_GB.inc +++ b/plugins/password/localization/en_GB.inc @@ -31,4 +31,8 @@ $messages['passwordweak'] = 'Password must include at least one number and one s $messages['passwordforbidden'] = 'Password contains forbidden characters.'; $messages['firstloginchange'] = 'This is your first login. Please change your password.'; $messages['disablednotice'] = 'The system is currently under maintenance and password change is not possible at the moment. Everything should be back to normal soon. We apologise for any inconvenience.'; -$messages['passwdinhistory'] = 'This password has already been used previously'; \ No newline at end of file +$messages['passwdinhistory'] = 'This password has already been used previously.'; +$messages['samepasswd'] = 'New password have to be different from the old one.'; +$messages['passwdexpirewarning'] = 'Warning! Your password will expire soon, change it before $expirationdatetime.'; +$messages['passwdexpired'] = 'Your password has expired, you have to change it now!'; + diff --git a/plugins/password/localization/en_US.inc b/plugins/password/localization/en_US.inc index f7e659892..b25495a33 100644 --- a/plugins/password/localization/en_US.inc +++ b/plugins/password/localization/en_US.inc @@ -35,4 +35,8 @@ $messages['passwordweak'] = 'Password must include at least one number and one p $messages['passwordforbidden'] = 'Password contains forbidden characters.'; $messages['firstloginchange'] = 'This is your first login. Please change your password.'; $messages['disablednotice'] = 'The system is currently under maintenance and password change is not possible at the moment. Everything should be back to normal soon. We apologize for any inconvenience.'; -$messages['passwinhistory'] = 'This password has already been used previously'; \ No newline at end of file +$messages['passwinhistory'] = 'This password has already been used previously.'; +$messages['samepasswd'] = 'New password have to be different from the old one.'; +$messages['passwdexpirewarning'] = 'Warning! Your password will expire soon, change it before $expirationdatetime.'; +$messages['passwdexpired'] = 'Your password has expired, you have to change it now!'; + diff --git a/plugins/password/localization/pl_PL.inc b/plugins/password/localization/pl_PL.inc index a70eb6e4f..a12574d79 100644 --- a/plugins/password/localization/pl_PL.inc +++ b/plugins/password/localization/pl_PL.inc @@ -31,4 +31,7 @@ $messages['passwordweak'] = 'Hasło musi zawierać co najmniej jedną cyfrę i z $messages['passwordforbidden'] = 'Hasło zawiera niedozwolone znaki.'; $messages['firstloginchange'] = 'To jest twoje pierwsze logowanie. Proszę zmień hasło.'; $messages['disablednotice'] = 'System jest w trakcie konserwacji i zmiana hasła w tym momencie nie jest możliwa. Wszystko powinno wrócić do normy w niedługim czasie. Przepraszamy za wszelkie niedogodności'; -$messages['passwdinhistory'] = 'To hasło było już użyte poprzednio.'; \ No newline at end of file +$messages['passwdinhistory'] = 'To hasło było już użyte poprzednio.'; +$messages['samepasswd'] = 'Nowe hasło musi być inne niż obecne.'; +$messages['passwdexpirewarning'] = 'UWAGA! Twoje hasło niebawem wygaśnie, zmień je przed $expirationdatetime.'; +$messages['passwdexpired'] = 'Twoje hasło wygasło, musisz je natychmiast zmienić!'; diff --git a/plugins/password/password.php b/plugins/password/password.php index 673d626c4..2c594df80 100644 --- a/plugins/password/password.php +++ b/plugins/password/password.php @@ -95,6 +95,17 @@ class password extends rcube_plugin if (rcube_utils::get_input_value('_first', rcube_utils::INPUT_GET)) { $rcmail->output->command('display_message', $this->gettext('firstloginchange'), 'notice'); } + else if (!empty($_SESSION['password_expires'])) { + if ($_SESSION['password_expires'] == 1) { + $rcmail->output->command('display_message', $this->gettext('passwdexpired'), 'error'); + } + else { + $rcmail->output->command('display_message', $this->gettext(array( + 'name' => 'passwdexpirewarning', + 'vars' => array('expirationdatetime' => $_SESSION['password_expires']) + )), 'warning'); + } + } $rcmail->output->send('plugin'); } @@ -153,9 +164,9 @@ class password extends rcube_plugin else if ($check_strength && (!preg_match("/[0-9]/", $newpwd) || !preg_match("/[^A-Za-z0-9]/", $newpwd))) { $rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error'); } - // password is the same as the old one, do nothing, return success + // password is the same as the old one, warn user, return error else if ($sespwd == $newpwd && !$rcmail->config->get('password_force_save')) { - $rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation'); + $rcmail->output->command('display_message', $this->gettext('samepasswd'), 'error'); } // try to save the password else if (!($res = $this->_save($curpwd, $newpwd))) { @@ -173,6 +184,9 @@ class password extends rcube_plugin rcube::write_log('password', sprintf('Password changed for user %s (ID: %d) from %s', $rcmail->get_user_name(), $rcmail->user->ID, rcube_utils::remote_ip())); } + + // Remove expiration date/time + $rcmail->session->remove('password_expires'); } else { $rcmail->output->command('display_message', $res, 'error'); @@ -334,8 +348,8 @@ class password extends rcube_plugin case PASSWORD_CONNECT_ERROR: $reason = $this->gettext('connecterror'); break; - case PASSWORD_IN_HISTORY: - $reason = $this->gettext('passwdinhistory'); + case PASSWORD_IN_HISTORY: + $reason = $this->gettext('passwdinhistory'); break; case PASSWORD_ERROR: default: