assword: Added possibility to nicely handle password epiration from other plugins (#5468)

Squashed commit of the following:

commit 41283ecab18321201c3adfef8e964e2aa0dc2032
Author: Aleksander Machniak <alec@alec.pl>
Date:   Sat Oct 15 08:37:31 2016 +0200

    CS fixes after PR merge, renamed session variable

commit b4440a0c4d15c194619c003683ff0d36787f82a8
Merge: cf9f0d8 5dee181
Author: Aleksander Machniak <alec@alec.pl>
Date:   Sat Oct 15 08:26:04 2016 +0200

    Merge branch 'master' of https://github.com/ZiBiS/roundcubemail into ZiBiS-master

commit 5dee1812e7
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Thu Oct 13 14:20:14 2016 +0200

    passing by session

commit 6ccb7e7d1d
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Thu Oct 13 11:45:43 2016 +0200

    formatted passwdexpdatetime should be set in session data

commit a43f30fdfc
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Thu Oct 13 11:10:06 2016 +0200

    _passwdexpwarning removed and expdatetime object is stored in session

commit 62ef852a11
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Thu Oct 13 10:24:39 2016 +0200

    String concatenation is removed and expdatetime is passed via session
    data.

commit 2aea3a4e85
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Wed Oct 12 10:20:58 2016 +0200

    Removing ppolicy plugin from my repository.

commit 8848c944ab
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Tue Oct 11 11:32:37 2016 +0200

    little correction of variables names

commit 5266c89da9
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Tue Oct 11 11:14:17 2016 +0200

    little corrections

commit c665b5c607
Author: Zbigniew Szmyd <zbigniew.szmyd@linseco.pl>
Date:   Tue Oct 11 10:31:05 2016 +0200

    A plugin to check LDAP password for expiration
pull/5480/head
Aleksander Machniak 8 years ago
parent cf9f0d8829
commit 33addff305

@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail
- Add missing sql upgrade file for 'ip' column resize in session table (#5465) - Add missing sql upgrade file for 'ip' column resize in session table (#5465)
- Do not show inline images of unsupported mimetype (#5463) - Do not show inline images of unsupported mimetype (#5463)
- Password: Added LDAP PPolicy driver (#5364) - 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 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) - 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) - Archive: Don't reload messages list when it's not needed (#5225)

@ -3,7 +3,7 @@
"type": "roundcube-plugin", "type": "roundcube-plugin",
"description": "Password Change for Roundcube. Plugin adds a possibility to change user password using many methods (drivers) via Settings/Password tab.", "description": "Password Change for Roundcube. Plugin adds a possibility to change user password using many methods (drivers) via Settings/Password tab.",
"license": "GPLv3+", "license": "GPLv3+",
"version": "4.1", "version": "4.2",
"authors": [ "authors": [
{ {
"name": "Aleksander Machniak", "name": "Aleksander Machniak",

@ -31,4 +31,8 @@ $messages['passwordweak'] = 'Password must include at least one number and one s
$messages['passwordforbidden'] = 'Password contains forbidden characters.'; $messages['passwordforbidden'] = 'Password contains forbidden characters.';
$messages['firstloginchange'] = 'This is your first login. Please change your password.'; $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['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'; $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!';

@ -35,4 +35,8 @@ $messages['passwordweak'] = 'Password must include at least one number and one p
$messages['passwordforbidden'] = 'Password contains forbidden characters.'; $messages['passwordforbidden'] = 'Password contains forbidden characters.';
$messages['firstloginchange'] = 'This is your first login. Please change your password.'; $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['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'; $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!';

@ -31,4 +31,7 @@ $messages['passwordweak'] = 'Hasło musi zawierać co najmniej jedną cyfrę i z
$messages['passwordforbidden'] = 'Hasło zawiera niedozwolone znaki.'; $messages['passwordforbidden'] = 'Hasło zawiera niedozwolone znaki.';
$messages['firstloginchange'] = 'To jest twoje pierwsze logowanie. Proszę zmień hasło.'; $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['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.'; $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ć!';

@ -95,6 +95,17 @@ class password extends rcube_plugin
if (rcube_utils::get_input_value('_first', rcube_utils::INPUT_GET)) { if (rcube_utils::get_input_value('_first', rcube_utils::INPUT_GET)) {
$rcmail->output->command('display_message', $this->gettext('firstloginchange'), 'notice'); $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'); $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))) { 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'); $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')) { 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 // try to save the password
else if (!($res = $this->_save($curpwd, $newpwd))) { 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', 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())); $rcmail->get_user_name(), $rcmail->user->ID, rcube_utils::remote_ip()));
} }
// Remove expiration date/time
$rcmail->session->remove('password_expires');
} }
else { else {
$rcmail->output->command('display_message', $res, 'error'); $rcmail->output->command('display_message', $res, 'error');
@ -334,8 +348,8 @@ class password extends rcube_plugin
case PASSWORD_CONNECT_ERROR: case PASSWORD_CONNECT_ERROR:
$reason = $this->gettext('connecterror'); $reason = $this->gettext('connecterror');
break; break;
case PASSWORD_IN_HISTORY: case PASSWORD_IN_HISTORY:
$reason = $this->gettext('passwdinhistory'); $reason = $this->gettext('passwdinhistory');
break; break;
case PASSWORD_ERROR: case PASSWORD_ERROR:
default: default:

Loading…
Cancel
Save