diff options
author | Hugues Hiegel <root@paranoid> | 2014-08-05 16:46:22 +0200 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2014-08-05 16:46:22 +0200 |
commit | 59478e06c25303a790a0840ab2ac30662c4ef781 (patch) | |
tree | 8d5e964a8f94adaef41efebb0597629f11495c42 /plugins/password | |
parent | 7c494b677f9e470ee0d32e62cfa8dc709f39e748 (diff) |
c'est la merde..working
Diffstat (limited to 'plugins/password')
34 files changed, 598 insertions, 312 deletions
diff --git a/plugins/password/README b/plugins/password/README index 262ebfd86..ef6f5b428 100644 --- a/plugins/password/README +++ b/plugins/password/README @@ -1,29 +1,31 @@ ----------------------------------------------------------------------- Password Plugin for Roundcube ----------------------------------------------------------------------- + Plugin that adds a possibility to change user password using many methods (drivers) via Settings/Password tab. + ----------------------------------------------------------------------- - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see http://www.gnu.org/licenses/. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @version @package_version@ - @author Aleksander Machniak <alec@alec.pl> + @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl> @author <see driver files for driver authors> ----------------------------------------------------------------------- - 1. Configuration - 2. Drivers + 1. Configuration + 2. Drivers 2.1. Database (sql) 2.2. Cyrus/SASL (sasl) 2.3. Poppassd/Courierpassd (poppassd) @@ -42,8 +44,7 @@ 2.16. DBMail (dbmail) 2.17. Expect (expect) 2.18. Samba (smb) - 2.19. Vpopmail daemon (vpopmaild) - 3. Driver API + 3. Driver API 1. Configuration @@ -64,40 +65,40 @@ ------------------- You can specify which database to connect by 'password_db_dsn' option and - what SQL query to execute by 'password_query'. See config.inc.php.dist file for + what SQL query to execute by 'password_query'. See main.inc.php.dist file for more info. Example implementations of an update_passwd function: - This is for use with LMS (http://lms.org.pl) database and postgres: - CREATE OR REPLACE FUNCTION update_passwd(hash text, account text) RETURNS integer AS $$ - DECLARE - res integer; - BEGIN - UPDATE passwd SET password = hash - WHERE login = split_part(account, '@', 1) - AND domainid = (SELECT id FROM domains WHERE name = split_part(account, '@', 2)) - RETURNING id INTO res; - RETURN res; - END; - $$ LANGUAGE plpgsql SECURITY DEFINER; + CREATE OR REPLACE FUNCTION update_passwd(hash text, account text) RETURNS integer AS $$ + DECLARE + res integer; + BEGIN + UPDATE passwd SET password = hash + WHERE login = split_part(account, '@', 1) + AND domainid = (SELECT id FROM domains WHERE name = split_part(account, '@', 2)) + RETURNING id INTO res; + RETURN res; + END; + $$ LANGUAGE plpgsql SECURITY DEFINER; - This is for use with a SELECT update_passwd(%o,%c,%u) query - Updates the password only when the old password matches the MD5 password - in the database - - CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text - MODIFIES SQL DATA - BEGIN - DECLARE currentsalt varchar(20); - DECLARE error text; - SET error = 'incorrect current password'; - SELECT substring_index(substr(user.password,4),_latin1'$',1) INTO currentsalt FROM users WHERE username=user; - SELECT '' INTO error FROM users WHERE username=user AND password=ENCRYPT(oldpass,currentsalt); - UPDATE users SET password=cryptpass WHERE username=user AND password=ENCRYPT(oldpass,currentsalt); - RETURN error; - END + Updates the password only when the old password matches the MD5 password + in the database + + CREATE FUNCTION update_password (oldpass text, cryptpass text, user text) RETURNS text + MODIFIES SQL DATA + BEGIN + DECLARE currentsalt varchar(20); + DECLARE error text; + SET error = 'incorrect current password'; + SELECT substring_index(substr(user.password,4),_latin1'$',1) INTO currentsalt FROM users WHERE username=user; + SELECT '' INTO error FROM users WHERE username=user AND password=ENCRYPT(oldpass,currentsalt); + UPDATE users SET password=cryptpass WHERE username=user AND password=ENCRYPT(oldpass,currentsalt); + RETURN error; + END Example SQL UPDATEs: @@ -137,11 +138,12 @@ Installation: - Change into the helpers directory. Edit the chgsaslpasswd.c file as is + Change into the helpers directory. Copy and edit + /usr/share/roundcube-plugins/examples/chgsaslpasswd.c as is documented within it. Compile the wrapper program: - gcc -o chgsaslpasswd chgsaslpasswd.c + gcc -o chgsaslpasswd chgsaslpasswd.c Chown the compiled chgsaslpasswd binary to the cyrus user and group that your browser runs as, then chmod them to 4550. @@ -149,13 +151,13 @@ For example, if your cyrus user is 'cyrus' and the apache server group is 'nobody' (I've been told Redhat runs Apache as user 'apache'): - chown cyrus:nobody chgsaslpasswd - chmod 4550 chgsaslpasswd + chown cyrus:nobody chgsaslpasswd + chmod 4550 chgsaslpasswd Stephen Carr has suggested users should try to run the scripts on a test account as the cyrus user eg; - su cyrus -c "./chgsaslpasswd -p test_account" + su cyrus -c "./chgsaslpasswd -p test_account" This will allow you to make sure that the script will work for your setup. Should the script not work, make sure that: @@ -191,12 +193,8 @@ 2.6. cPanel (cpanel) -------------------- - Install cPanel XMLAPI Client Class into Roundcube program/lib directory - or any other place in PHP include path. You can get the class from - https://raw.github.com/CpanelInc/xmlapi-php/master/xmlapi.php - - You can configure parameters for connection to cPanel's API interface. - See config.inc.php.dist file for more info. + You can specify parameters for HTTP connection to cPanel's admin + interface. See config.inc.php.dist file for more info. 2.7. XIMSS/Communigate (ximms) @@ -210,7 +208,8 @@ ---------------------------- As in sasl driver this one allows to change password using shell - utility called "virtualmin". See helpers/chgvirtualminpasswd.c for + utility called "virtualmin". See + /usr/share/doc/roundcube-plugins/examples/chgvirtualminpasswd.c for installation instructions. See also config.inc.php.dist file. @@ -235,8 +234,9 @@ Driver that adds functionality to change the systems user password via the 'chpasswd' command. See config.inc.php.dist file. - Attached wrapper script (helpers/chpass-wrapper.py) restricts password changes - to uids >= 1000 and can deny requests based on a blacklist. + Attached wrapper script + (/usr/share/doc/roundcube-plugins/examples/chpass-wrapper.py) restricts + password changes to uids >= 1000 and can deny requests based on a blacklist. 2.12. LDAP - no PEAR (ldap_simple) @@ -247,7 +247,7 @@ This driver is fully compatible with the ldap driver, but does not require (or uses) the - $config['password_ldap_force_replace'] variable. + $rcmail_config['password_ldap_force_replace'] variable. Other advantages: * Connects only once with the LDAP server when using the search user. * Does not read the DN, but only replaces the password within (that is @@ -300,16 +300,6 @@ Driver to change Samba user password via the 'smbpasswd' command. See config.inc.php.dist file for configuration description. - 2.19. Vpopmail daemon (vpopmaild) - ----------------------------------- - - Driver for the daemon of vpopmail. Vpopmail is used with qmail to - enable virtual users that are saved in a database and not in /etc/passwd. - - Set $config['password_vpopmaild_host'] to the host where vpopmaild runs. - - Set $config['password_vpopmaild_port'] to the port of vpopmaild. - 3. Driver API ------------- diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist index 82f6617e5..a40e2a93f 100644 --- a/plugins/password/config.inc.php.dist +++ b/plugins/password/config.inc.php.dist @@ -4,43 +4,39 @@ // ----------------------- // A driver to use for password change. Default: "sql". // See README file for list of supported driver names. -$config['password_driver'] = 'sql'; +$rcmail_config['password_driver'] = 'sql'; // Determine whether current password is required to change password. // Default: false. -$config['password_confirm_current'] = true; +$rcmail_config['password_confirm_current'] = true; // Require the new password to be a certain length. // set to blank to allow passwords of any length -$config['password_minimum_length'] = 0; +$rcmail_config['password_minimum_length'] = 0; // Require the new password to contain a letter and punctuation character // Change to false to remove this check. -$config['password_require_nonalpha'] = false; +$rcmail_config['password_require_nonalpha'] = false; // Enables logging of password changes into logs/password -$config['password_log'] = false; +$rcmail_config['password_log'] = false; // Comma-separated list of login exceptions for which password change // will be not available (no Password tab in Settings) -$config['password_login_exceptions'] = null; +$rcmail_config['password_login_exceptions'] = null; // Array of hosts that support password changing. Default is NULL. // Listed hosts will feature a Password option in Settings; others will not. // Example: -//$config['password_hosts'] = array('mail.example.com', 'mail2.example.org'); -$config['password_hosts'] = null; - -// Enables saving the new password even if it matches the old password. Useful -// for upgrading the stored passwords after the encryption scheme has changed. -$config['password_force_save'] = false; +//$rcmail_config['password_hosts'] = array('mail.example.com', 'mail2.example.org'); +$rcmail_config['password_hosts'] = null; // SQL Driver options // ------------------ // PEAR database DSN for performing the query. By default // Roundcube DB settings are used. -$config['password_db_dsn'] = ''; +$rcmail_config['password_db_dsn'] = ''; // The SQL query used to change the password. // The query can contain the following macros that will be expanded as follows: @@ -60,52 +56,52 @@ $config['password_db_dsn'] = ''; // (in case the username is an email address) // Escaping of macros is handled by this module. // Default: "SELECT update_passwd(%c, %u)" -$config['password_query'] = 'SELECT update_passwd(%c, %u)'; +$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)'; // By default the crypt() function which is used to create the '%c' // parameter uses the md5 algorithm. To use different algorithms // you can choose between: des, md5, blowfish, sha256, sha512. // Before using other hash functions than des or md5 please make sure // your operating system supports the other hash functions. -$config['password_crypt_hash'] = 'md5'; +$rcmail_config['password_crypt_hash'] = 'md5'; // By default domains in variables are using unicode. // Enable this option to use punycoded names -$config['password_idn_ascii'] = false; +$rcmail_config['password_idn_ascii'] = false; // Path for dovecotpw (if not in $PATH) -// $config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw'; +// $rcmail_config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw'; // Dovecot method (dovecotpw -s 'method') -$config['password_dovecotpw_method'] = 'CRAM-MD5'; +$rcmail_config['password_dovecotpw_method'] = 'CRAM-MD5'; // Enables use of password with crypt method prefix in %D, e.g. {MD5}$1$LUiMYWqx$fEkg/ggr/L6Mb2X7be4i1/ -$config['password_dovecotpw_with_method'] = false; +$rcmail_config['password_dovecotpw_with_method'] = false; // Using a password hash for %n and %q variables. // Determine which hashing algorithm should be used to generate // the hashed new and current password for using them within the // SQL query. Requires PHP's 'hash' extension. -$config['password_hash_algorithm'] = 'sha1'; +$rcmail_config['password_hash_algorithm'] = 'sha1'; // You can also decide whether the hash should be provided // as hex string or in base64 encoded format. -$config['password_hash_base64'] = false; +$rcmail_config['password_hash_base64'] = false; // Poppassd Driver options // ----------------------- // The host which changes the password -$config['password_pop_host'] = 'localhost'; +$rcmail_config['password_pop_host'] = 'localhost'; // TCP port used for poppassd connections -$config['password_pop_port'] = 106; +$rcmail_config['password_pop_port'] = 106; // SASL Driver options // ------------------- // Additional arguments for the saslpasswd2 call -$config['password_saslpasswd_args'] = ''; +$rcmail_config['password_saslpasswd_args'] = ''; // LDAP and LDAP_SIMPLE Driver options @@ -114,41 +110,41 @@ $config['password_saslpasswd_args'] = ''; // You can provide one or several hosts in an array in which case the hosts are tried from left to right. // Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com'); // Default: 'localhost' -$config['password_ldap_host'] = 'localhost'; +$rcmail_config['password_ldap_host'] = 'localhost'; // LDAP server port to connect to // Default: '389' -$config['password_ldap_port'] = '389'; +$rcmail_config['password_ldap_port'] = '389'; // TLS is started after connecting // Using TLS for password modification is recommanded. // Default: false -$config['password_ldap_starttls'] = false; +$rcmail_config['password_ldap_starttls'] = false; // LDAP version // Default: '3' -$config['password_ldap_version'] = '3'; +$rcmail_config['password_ldap_version'] = '3'; // LDAP base name (root directory) // Exemple: 'dc=exemple,dc=com' -$config['password_ldap_basedn'] = 'dc=exemple,dc=com'; +$rcmail_config['password_ldap_basedn'] = 'dc=exemple,dc=com'; // LDAP connection method // There is two connection method for changing a user's LDAP password. // 'user': use user credential (recommanded, require password_confirm_current=true) // 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW) // Default: 'user' -$config['password_ldap_method'] = 'user'; +$rcmail_config['password_ldap_method'] = 'user'; // LDAP Admin DN // Used only in admin connection mode // Default: null -$config['password_ldap_adminDN'] = null; +$rcmail_config['password_ldap_adminDN'] = null; // LDAP Admin Password // Used only in admin connection mode // Default: null -$config['password_ldap_adminPW'] = null; +$rcmail_config['password_ldap_adminPW'] = null; // LDAP user DN mask // The user's DN is mandatory and as we only have his login, @@ -158,7 +154,7 @@ $config['password_ldap_adminPW'] = null; // '%domain' will be replaced by the current roundcube user's domain part // '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com" // Exemple: 'uid=%login,ou=people,dc=exemple,dc=com' -$config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com'; +$rcmail_config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com'; // LDAP search DN // The DN roundcube should bind with to find out user's DN @@ -169,7 +165,7 @@ $config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com'; // users login to find his DN instead. A common reason might be that // your users are placed under different ou's like engineering or // sales which cannot be derived from their login only. -$config['password_ldap_searchDN'] = 'cn=roundcube,ou=services,dc=example,dc=com'; +$rcmail_config['password_ldap_searchDN'] = 'cn=roundcube,ou=services,dc=example,dc=com'; // LDAP search password // If password_ldap_searchDN is set, the password to use for @@ -179,13 +175,13 @@ $config['password_ldap_searchDN'] = 'cn=roundcube,ou=services,dc=example,dc=com' // is only accesible to roundcube and don't forget to restrict roundcube's access to // your directory as much as possible using ACLs. Should this password be compromised // you want to minimize the damage. -$config['password_ldap_searchPW'] = 'secret'; +$rcmail_config['password_ldap_searchPW'] = 'secret'; // LDAP search base // If password_ldap_searchDN is set, the base to search in using the filter below. // Note that you should comment out the default password_ldap_userDN_mask setting // for this to take effect. -$config['password_ldap_search_base'] = 'ou=people,dc=example,dc=com'; +$rcmail_config['password_ldap_search_base'] = 'ou=people,dc=example,dc=com'; // LDAP search filter // If password_ldap_searchDN is set, the filter to use when @@ -197,7 +193,7 @@ $config['password_ldap_search_base'] = 'ou=people,dc=example,dc=com'; // '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com" // Example: '(uid=%login)' // Example: '(&(objectClass=posixAccount)(uid=%login))' -$config['password_ldap_search_filter'] = '(uid=%login)'; +$rcmail_config['password_ldap_search_filter'] = '(uid=%login)'; // LDAP password hash type // Standard LDAP encryption type which must be one of: crypt, @@ -205,34 +201,34 @@ $config['password_ldap_search_filter'] = '(uid=%login)'; // Please note that most encodage types require external libraries // to be included in your PHP installation, see function hashPassword in drivers/ldap.php for more info. // Default: 'crypt' -$config['password_ldap_encodage'] = 'crypt'; +$rcmail_config['password_ldap_encodage'] = 'crypt'; // LDAP password attribute // Name of the ldap's attribute used for storing user password // Default: 'userPassword' -$config['password_ldap_pwattr'] = 'userPassword'; +$rcmail_config['password_ldap_pwattr'] = 'userPassword'; // LDAP password force replace // Force LDAP replace in cases where ACL allows only replace not read // See http://pear.php.net/package/Net_LDAP2/docs/latest/Net_LDAP2/Net_LDAP2_Entry.html#methodreplace // Default: true -$config['password_ldap_force_replace'] = true; +$rcmail_config['password_ldap_force_replace'] = true; // LDAP Password Last Change Date // Some places use an attribute to store the date of the last password change // The date is meassured in "days since epoch" (an integer value) // Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange) -$config['password_ldap_lchattr'] = ''; +$rcmail_config['password_ldap_lchattr'] = ''; // LDAP Samba password attribute, e.g. sambaNTPassword // Name of the LDAP's Samba attribute used for storing user password -$config['password_ldap_samba_pwattr'] = ''; +$rcmail_config['password_ldap_samba_pwattr'] = ''; // LDAP Samba Password Last Change Date attribute, e.g. sambaPwdLastSet // Some places use an attribute to store the date of the last password change // The date is meassured in "seconds since epoch" (an integer value) // Whenever the password is changed, the attribute will be updated if set -$config['password_ldap_samba_lchattr'] = ''; +$rcmail_config['password_ldap_samba_lchattr'] = ''; // DirectAdmin Driver options @@ -242,57 +238,63 @@ $config['password_ldap_samba_lchattr'] = ''; // The host can contain the following macros that will be expanded as follows: // %h is replaced with the imap host (from the session info) // %d is replaced with the domain part of the username (if the username is an email) -$config['password_directadmin_host'] = 'tcp://localhost'; +$rcmail_config['password_directadmin_host'] = 'tcp://localhost'; // TCP port used for DirectAdmin connections -$config['password_directadmin_port'] = 2222; +$rcmail_config['password_directadmin_port'] = 2222; // vpopmaild Driver options // ----------------------- // The host which changes the password -$config['password_vpopmaild_host'] = 'localhost'; +$rcmail_config['password_vpopmaild_host'] = 'localhost'; // TCP port used for vpopmaild connections -$config['password_vpopmaild_port'] = 89; +$rcmail_config['password_vpopmaild_port'] = 89; // cPanel Driver options // -------------------------- // The cPanel Host name -$config['password_cpanel_host'] = 'host.domain.com'; +$rcmail_config['password_cpanel_host'] = 'host.domain.com'; // The cPanel admin username -$config['password_cpanel_username'] = 'username'; +$rcmail_config['password_cpanel_username'] = 'username'; // The cPanel admin password -$config['password_cpanel_password'] = 'password'; +$rcmail_config['password_cpanel_password'] = 'password'; // The cPanel port to use -$config['password_cpanel_port'] = 2087; +$rcmail_config['password_cpanel_port'] = 2082; + +// Using ssl for cPanel connections? +$rcmail_config['password_cpanel_ssl'] = true; + +// The cPanel theme in use +$rcmail_config['password_cpanel_theme'] = 'x'; // XIMSS (Communigate server) Driver options // ----------------------------------------- // Host name of the Communigate server -$config['password_ximss_host'] = 'mail.example.com'; +$rcmail_config['password_ximss_host'] = 'mail.example.com'; // XIMSS port on Communigate server -$config['password_ximss_port'] = 11024; +$rcmail_config['password_ximss_port'] = 11024; // chpasswd Driver options // --------------------- // Command to use -$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null'; +$rcmail_config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null'; // XMail Driver options // --------------------- -$config['xmail_host'] = 'localhost'; -$config['xmail_user'] = 'YourXmailControlUser'; -$config['xmail_pass'] = 'YourXmailControlPass'; -$config['xmail_port'] = 6017; +$rcmail_config['xmail_host'] = 'localhost'; +$rcmail_config['xmail_user'] = 'YourXmailControlUser'; +$rcmail_config['xmail_pass'] = 'YourXmailControlPass'; +$rcmail_config['xmail_port'] = 6017; // hMail Driver options @@ -300,9 +302,9 @@ $config['xmail_port'] = 6017; // Remote hMailServer configuration // true: HMailserver is on a remote box (php.ini: com.allow_dcom = true) // false: Hmailserver is on same box as PHP -$config['hmailserver_remote_dcom'] = false; +$rcmail_config['hmailserver_remote_dcom'] = false; // Windows credentials -$config['hmailserver_server'] = array( +$rcmail_config['hmailserver_server'] = array( 'Server' => 'localhost', // hostname or ip address 'Username' => 'administrator', // windows username 'Password' => 'password' // windows user password @@ -320,8 +322,7 @@ $config['hmailserver_server'] = array( // 5: domain-username // 6: username_domain // 7: domain_username -// 8: username@domain; mbox.username -$config['password_virtualmin_format'] = 8; +$config['password_virtualmin_format'] = 0; // pw_usermod Driver options @@ -329,36 +330,32 @@ $config['password_virtualmin_format'] = 8; // Use comma delimited exlist to disable password change for users // Add the following line to visudo to tighten security: // www ALL=NOPASSWORD: /usr/sbin/pw -$config['password_pw_usermod_cmd'] = 'sudo /usr/sbin/pw usermod -h 0 -n'; +$rcmail_config['password_pw_usermod_cmd'] = 'sudo /usr/sbin/pw usermod -h 0 -n'; // DBMail Driver options // ------------------- // Additional arguments for the dbmail-users call -$config['password_dbmail_args'] = '-p sha512'; +$rcmail_config['password_dbmail_args'] = '-p sha512'; // Expect Driver options // --------------------- // Location of expect binary -$config['password_expect_bin'] = '/usr/bin/expect'; +$rcmail_config['password_expect_bin'] = '/usr/bin/expect'; // Location of expect script (see helpers/passwd-expect) -$config['password_expect_script'] = ''; +$rcmail_config['password_expect_script'] = ''; // Arguments for the expect script. See the helpers/passwd-expect file for details. // This is probably a good starting default: // -telent -host localhost -output /tmp/passwd.log -log /tmp/passwd.log -$config['password_expect_params'] = ''; +$rcmail_config['password_expect_params'] = ''; // smb Driver options // --------------------- // Samba host (default: localhost) -// Supported replacement variables: -// %n - hostname ($_SERVER['SERVER_NAME']) -// %t - hostname without the first part -// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part) -$config['password_smb_host'] = 'localhost'; +$rcmail_config['password_smb_host'] = 'localhost'; // Location of smbpasswd binary -$config['password_smb_cmd'] = '/usr/bin/smbpasswd'; +$rcmail_config['password_smb_cmd'] = '/usr/bin/smbpasswd'; diff --git a/plugins/password/drivers/chpasswd.php b/plugins/password/drivers/chpasswd.php index 137275e69..3ea10159c 100644 --- a/plugins/password/drivers/chpasswd.php +++ b/plugins/password/drivers/chpasswd.php @@ -26,7 +26,7 @@ class rcube_chpasswd_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/cpanel.php b/plugins/password/drivers/cpanel.php index b71c33ec1..79887109b 100644 --- a/plugins/password/drivers/cpanel.php +++ b/plugins/password/drivers/cpanel.php @@ -4,43 +4,95 @@ * cPanel Password Driver * * Driver that adds functionality to change the users cPanel password. - * Originally written by Fulvio Venturelli <fulvio@venturelli.org> + * The cPanel PHP API code has been taken from: http://www.phpclasses.org/browse/package/3534.html * - * Completely rewritten using the cPanel API2 call Email::passwdpop - * as opposed to the original coding against the UI, which is a fragile method that - * makes the driver to always return a failure message for any language other than English - * see http://trac.roundcube.net/ticket/1487015 + * This driver has been tested with Hostmonster hosting and seems to work fine. * - * This driver has been tested with o2switch hosting and seems to work fine. - * - * @version 3.0 - * @author Christian Chech <christian@chech.fr> + * @version 2.0 + * @author Fulvio Venturelli <fulvio@venturelli.org> */ class rcube_cpanel_password { public function save($curpas, $newpass) { - require_once 'xmlapi.php'; - $rcmail = rcmail::get_instance(); - $this->cuser = $rcmail->config->get('password_cpanel_username'); - - // Setup the xmlapi connection - $this->xmlapi = new xmlapi($rcmail->config->get('password_cpanel_host')); - $this->xmlapi->set_port($rcmail->config->get('password_cpanel_port')); - $this->xmlapi->password_auth($this->cuser, $rcmail->config->get('password_cpanel_password')); - $this->xmlapi->set_output('json'); - $this->xmlapi->set_debug(0); + // Create a cPanel email object + $cPanel = new emailAccount($rcmail->config->get('password_cpanel_host'), + $rcmail->config->get('password_cpanel_username'), + $rcmail->config->get('password_cpanel_password'), + $rcmail->config->get('password_cpanel_port'), + $rcmail->config->get('password_cpanel_ssl'), + $rcmail->config->get('password_cpanel_theme'), + $_SESSION['username'] ); - if ($this->setPassword($_SESSION['username'], $newpass)) { + if ($cPanel->setPassword($newpass)) { return PASSWORD_SUCCESS; } else { return PASSWORD_ERROR; } } +} + + +class HTTP +{ + function HTTP($host, $username, $password, $port, $ssl, $theme) + { + $this->ssl = $ssl ? 'ssl://' : ''; + $this->username = $username; + $this->password = $password; + $this->theme = $theme; + $this->auth = base64_encode($username . ':' . $password); + $this->port = $port; + $this->host = $host; + $this->path = '/frontend/' . $theme . '/'; + } + + function getData($url, $data = '') + { + $url = $this->path . $url; + if (is_array($data)) { + $url = $url . '?'; + foreach ($data as $key => $value) { + $url .= urlencode($key) . '=' . urlencode($value) . '&'; + } + $url = substr($url, 0, -1); + } + + $response = ''; + $fp = fsockopen($this->ssl . $this->host, $this->port); + if (!$fp) { + return false; + } + + $out = 'GET ' . $url . ' HTTP/1.0' . "\r\n"; + $out .= 'Authorization: Basic ' . $this->auth . "\r\n"; + $out .= 'Connection: Close' . "\r\n\r\n"; + fwrite($fp, $out); + while (!feof($fp)) { + $response .= @fgets($fp); + } + fclose($fp); + return $response; + } +} + + +class emailAccount +{ + function emailAccount($host, $username, $password, $port, $ssl, $theme, $address) + { + $this->HTTP = new HTTP($host, $username, $password, $port, $ssl, $theme); + if (strpos($address, '@')) { + list($this->email, $this->domain) = explode('@', $address); + } + else { + list($this->email, $this->domain) = array($address, ''); + } + } /** * Change email account password @@ -49,24 +101,16 @@ class rcube_cpanel_password * @param string $password email account password * @return bool */ - function setPassword($address, $password) + function setPassword($password) { - if (strpos($address, '@')) { - list($data['email'], $data['domain']) = explode('@', $address); - } - else { - list($data['email'], $data['domain']) = array($address, ''); - } - + $data['email'] = $this->email; + $data['domain'] = $this->domain; $data['password'] = $password; + $response = $this->HTTP->getData('mail/dopasswdpop.html', $data); - $query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data); - $query = json_decode($query, true); - - if ($query['cpanelresult']['data'][0]['result'] == 1) { + if (strpos($response, 'success') && !strpos($response, 'failure')) { return true; } - return false; } } diff --git a/plugins/password/drivers/dbmail.php b/plugins/password/drivers/dbmail.php index 529027b8d..e4c0d52e3 100644 --- a/plugins/password/drivers/dbmail.php +++ b/plugins/password/drivers/dbmail.php @@ -29,7 +29,7 @@ class rcube_dbmail_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/directadmin.php b/plugins/password/drivers/directadmin.php index 44ecea406..fb156cea9 100644 --- a/plugins/password/drivers/directadmin.php +++ b/plugins/password/drivers/directadmin.php @@ -43,7 +43,7 @@ class rcube_directadmin_password $response = $Socket->fetch_parsed_body(); //DEBUG - //rcube::console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]"); + //console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]"); if($Socket->result_status_code != 200) return array('code' => PASSWORD_CONNECT_ERROR, 'message' => $Socket->error[0]); @@ -297,6 +297,7 @@ class HTTPSocket { $status = socket_get_status($socket); $startTime = time(); $length = 0; + $prevSecond = 0; while ( !feof($socket) && !$status['timed_out'] ) { $chunk = fgets($socket,1024); diff --git a/plugins/password/drivers/expect.php b/plugins/password/drivers/expect.php index 1f68924df..7a191e254 100644 --- a/plugins/password/drivers/expect.php +++ b/plugins/password/drivers/expect.php @@ -45,7 +45,7 @@ class rcube_expect_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/hmail.php b/plugins/password/drivers/hmail.php index 650434617..104c851ae 100644 --- a/plugins/password/drivers/hmail.php +++ b/plugins/password/drivers/hmail.php @@ -5,6 +5,7 @@ * * @version 2.0 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net> + * */ class rcube_hmail_password @@ -25,8 +26,8 @@ class rcube_hmail_password $obApp = new COM("hMailServer.Application"); } catch (Exception $e) { - rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); - rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); return PASSWORD_ERROR; } @@ -38,7 +39,8 @@ class rcube_hmail_password else { $domain = $rcmail->config->get('username_domain',false); if (!$domain) { - rcube::write_log('errors','Plugin password (hmail driver): $config[\'username_domain\'] is not defined.'); + write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.'); + write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com'); return PASSWORD_ERROR; } $username = $username . "@" . $domain; @@ -53,8 +55,8 @@ class rcube_hmail_password return PASSWORD_SUCCESS; } catch (Exception $e) { - rcube::write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); - rcube::write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); + write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage()))); + write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set."); return PASSWORD_ERROR; } } diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php index 548d327e1..f773335ac 100644 --- a/plugins/password/drivers/ldap.php +++ b/plugins/password/drivers/ldap.php @@ -271,7 +271,7 @@ class rcube_ldap_password case 'samba': if (function_exists('hash')) { - $cryptedPassword = hash('md4', rcube_charset::convert($passwordClear, RCUBE_CHARSET, 'UTF-16LE')); + $cryptedPassword = hash('md4', rcube_charset_convert($passwordClear, RCMAIL_CHARSET, 'UTF-16LE')); $cryptedPassword = strtoupper($cryptedPassword); } else { /* Your PHP install does not have the hash() function */ diff --git a/plugins/password/drivers/ldap_simple.php b/plugins/password/drivers/ldap_simple.php index d47e14492..01385f2d0 100644 --- a/plugins/password/drivers/ldap_simple.php +++ b/plugins/password/drivers/ldap_simple.php @@ -240,7 +240,7 @@ class rcube_ldap_simple_password break; case 'samba': if (function_exists('hash')) { - $crypted_password = hash('md4', rcube_charset::convert($password_clear, RCUBE_CHARSET, 'UTF-16LE')); + $crypted_password = hash('md4', rcube_charset_convert($password_clear, RCMAIL_CHARSET, 'UTF-16LE')); $crypted_password = strtoupper($crypted_password); } else { /* Your PHP install does not have the hash() function */ diff --git a/plugins/password/drivers/pam.php b/plugins/password/drivers/pam.php index 4d0ba1656..15a802c74 100644 --- a/plugins/password/drivers/pam.php +++ b/plugins/password/drivers/pam.php @@ -21,7 +21,7 @@ class rcube_pam_password } } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, @@ -30,7 +30,7 @@ class rcube_pam_password } } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/pw_usermod.php b/plugins/password/drivers/pw_usermod.php index 237e275a7..5b92fcbfb 100644 --- a/plugins/password/drivers/pw_usermod.php +++ b/plugins/password/drivers/pw_usermod.php @@ -28,7 +28,7 @@ class rcube_pw_usermod_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/sasl.php b/plugins/password/drivers/sasl.php index 8776eff2e..9380cf838 100644 --- a/plugins/password/drivers/sasl.php +++ b/plugins/password/drivers/sasl.php @@ -32,7 +32,7 @@ class rcube_sasl_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/smb.php b/plugins/password/drivers/smb.php index 9f2b96afa..88021156f 100644 --- a/plugins/password/drivers/smb.php +++ b/plugins/password/drivers/smb.php @@ -26,15 +26,13 @@ class rcube_smb_password public function save($currpass, $newpass) { - $host = rcmail::get_instance()->config->get('password_smb_host','localhost'); - $bin = rcmail::get_instance()->config->get('password_smb_cmd','/usr/bin/smbpasswd'); + $host = rcmail::get_instance()->config->get('password_smb_host','localhost'); + $bin = rcmail::get_instance()->config->get('password_smb_cmd','/usr/bin/smbpasswd'); $username = $_SESSION['username']; - $host = rcube_utils::parse_host($host); - $tmpfile = tempnam(sys_get_temp_dir(),'smb'); - $cmd = $bin . ' -r ' . $host . ' -s -U "' . $username . '" > ' . $tmpfile . ' 2>&1'; - $handle = @popen($cmd, 'w'); - + $tmpfile = tempnam(sys_get_temp_dir(),'smb'); + $cmd = $bin . ' -r ' . $host . ' -s -U "' . $username . '" > ' . $tmpfile . ' 2>&1'; + $handle = @popen($cmd, 'w'); fputs($handle, $currpass."\n"); fputs($handle, $newpass."\n"); fputs($handle, $newpass."\n"); @@ -46,7 +44,7 @@ class rcube_smb_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/sql.php b/plugins/password/drivers/sql.php index 7a51dfe44..8c8dc87b5 100644 --- a/plugins/password/drivers/sql.php +++ b/plugins/password/drivers/sql.php @@ -34,9 +34,8 @@ class rcube_sql_password $db = $rcmail->get_dbh(); } - if ($db->is_error()) { + if ($err = $db->is_error()) return PASSWORD_ERROR; - } // crypted password if (strpos($sql, '%c') !== FALSE) { @@ -118,7 +117,7 @@ class rcube_sql_password // hashed passwords if (preg_match('/%[n|q]/', $sql)) { if (!extension_loaded('hash')) { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, @@ -165,14 +164,14 @@ class rcube_sql_password // convert domains to/from punnycode if ($rcmail->config->get('password_idn_ascii')) { - $domain_part = rcube_utils::idn_to_ascii($domain_part); - $username = rcube_utils::idn_to_ascii($username); - $host = rcube_utils::idn_to_ascii($host); + $domain_part = rcube_idn_to_ascii($domain_part); + $username = rcube_idn_to_ascii($username); + $host = rcube_idn_to_ascii($host); } else { - $domain_part = rcube_utils::idn_to_utf8($domain_part); - $username = rcube_utils::idn_to_utf8($username); - $host = rcube_utils::idn_to_utf8($host); + $domain_part = rcube_idn_to_utf8($domain_part); + $username = rcube_idn_to_utf8($username); + $host = rcube_idn_to_utf8($host); } // at least we should always have the local part @@ -185,7 +184,7 @@ class rcube_sql_password if (!$db->is_error()) { if (strtolower(substr(trim($sql),0,6)) == 'select') { - if ($db->fetch_array($res)) + if ($result = $db->fetch_array($res)) return PASSWORD_SUCCESS; } else { // This is the good case: 1 row updated diff --git a/plugins/password/drivers/virtualmin.php b/plugins/password/drivers/virtualmin.php index 2c7aee617..40f5c2529 100644 --- a/plugins/password/drivers/virtualmin.php +++ b/plugins/password/drivers/virtualmin.php @@ -18,8 +18,7 @@ class rcube_virtualmin_password { function save($currpass, $newpass) { - $rcmail = rcmail::get_instance(); - + $rcmail = rcmail::get_instance(); $format = $rcmail->config->get('password_virtualmin_format', 0); $username = $_SESSION['username']; @@ -48,14 +47,14 @@ class rcube_virtualmin_password $pieces = explode("_", $username); $domain = $pieces[0]; break; - case 8: // domain taken from alias, username left as it was - $email = $rcmail->user->data['alias']; - $domain = substr(strrchr($email, "@"), 1); - break; default: // username@domain $domain = substr(strrchr($username, "@"), 1); } + if (!$domain) { + $domain = $rcmail->user->get_username('domain'); + } + $username = escapeshellcmd($username); $domain = escapeshellcmd($domain); $newpass = escapeshellcmd($newpass); @@ -67,7 +66,7 @@ class rcube_virtualmin_password return PASSWORD_SUCCESS; } else { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, diff --git a/plugins/password/drivers/xmail.php b/plugins/password/drivers/xmail.php index 47beb2178..33a49ffe3 100644 --- a/plugins/password/drivers/xmail.php +++ b/plugins/password/drivers/xmail.php @@ -10,10 +10,10 @@ * Setup xmail_host, xmail_user, xmail_pass and xmail_port into * config.inc.php of password plugin as follows: * - * $config['xmail_host'] = 'localhost'; - * $config['xmail_user'] = 'YourXmailControlUser'; - * $config['xmail_pass'] = 'YourXmailControlPass'; - * $config['xmail_port'] = 6017; + * $rcmail_config['xmail_host'] = 'localhost'; + * $rcmail_config['xmail_user'] = 'YourXmailControlUser'; + * $rcmail_config['xmail_pass'] = 'YourXmailControlPass'; + * $rcmail_config['xmail_port'] = 6017; * */ @@ -32,7 +32,7 @@ class rcube_xmail_password $xmail->port = $rcmail->config->get('xmail_port'); if (!$xmail->connect()) { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, @@ -42,7 +42,7 @@ class rcube_xmail_password } else if (!$xmail->send("userpasswd\t".$domain."\t".$user."\t".$newpass."\n")) { $xmail->close(); - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, @@ -67,7 +67,7 @@ class XMail { function send($msg) { socket_write($this->socket,$msg); - if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { + if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { return false; } return true; @@ -85,7 +85,7 @@ class XMail { return false; } - if (substr(socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { + if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") { socket_close($this->socket); return false; } diff --git a/plugins/password/localization/ar.inc b/plugins/password/localization/ar.inc new file mode 100644 index 000000000..521127a8f --- /dev/null +++ b/plugins/password/localization/ar.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'تغيير كلمة المرور'; +$labels['curpasswd'] = 'كلمة المرور الحالية:'; +$labels['newpasswd'] = 'كلمة المرور الجديدة:'; +$labels['confpasswd'] = 'تأكيد كلمة المرور الجديدة:'; +$messages['nopassword'] = 'من فضلك أدخل كلمة المرور الجديدة.'; +$messages['nocurpassword'] = 'من فضلك أدخل كلمة المرور الحالية.'; +$messages['passwordincorrect'] = 'كلمة المرور الحالية غير صحيحة.'; +$messages['passwordinconsistency'] = 'كلمة المرور غير مطابقة حاول مجددا'; +$messages['crypterror'] = 'تعذر حفظ كلمة المرور الجديدة. وظيفة التشفير مفقودة.'; +$messages['connecterror'] = 'تعذر حفظ كلمة المرور الجديدة. خطأ بالإتصال.'; +$messages['internalerror'] = 'تعذر حفظ كلمة المرور الجديدة.'; +$messages['passwordshort'] = 'كلمة المرور يجب على الأقل $length أحرف'; +$messages['passwordweak'] = ' كلمة المرور يجب أن تتضمن رقم واحد على الأقل وحرف ترقيم واحد.'; +$messages['passwordforbidden'] = 'كلمة المرور تحتوى على أحرف ممنوعة'; +?> diff --git a/plugins/password/localization/ar_SA.inc b/plugins/password/localization/ar_SA.inc new file mode 100644 index 000000000..990505bac --- /dev/null +++ b/plugins/password/localization/ar_SA.inc @@ -0,0 +1,29 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'تغيير كلمة المرور'; +$labels['curpasswd'] = 'كلمة المرور الحالية'; +$labels['newpasswd'] = 'كلمة المرور الجديدة'; +$labels['confpasswd'] = 'تأكيد كلمة المرور الجديدة'; +$messages['nopassword'] = 'من فضلك أدخل كلمة مرور جديدة'; +$messages['nocurpassword'] = 'من فضلك أدخل كلمة المرور الحالية'; +$messages['passwordincorrect'] = 'كلمة المرور الحالية غير صحيحة'; +$messages['passwordinconsistency'] = 'كلمة المرور غير مطابقة, أعد المحاولة'; +$messages['connecterror'] = 'تعذر حفظ كلمة المرور الجديدة. خطأ في الإتصال'; +$messages['internalerror'] = 'تعذر حفظ كلمة المرور الجديدة'; +$messages['passwordforbidden'] = 'كلمة المرور تحتوي حروفاً ممنوعة'; +?> diff --git a/plugins/password/localization/ast.inc b/plugins/password/localization/ast.inc new file mode 100644 index 000000000..99b283ec5 --- /dev/null +++ b/plugins/password/localization/ast.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'Camudar contraseña'; +$labels['curpasswd'] = 'Contraseña actual:'; +$labels['newpasswd'] = 'Contraseña nueva:'; +$labels['confpasswd'] = 'Confirmar contraseña:'; +$messages['nopassword'] = 'Por favor, introduz una contraseña nueva.'; +$messages['nocurpassword'] = 'Por favor, introduz la contraseña actual.'; +$messages['passwordincorrect'] = 'La contraseña actual ye incorreuta.'; +$messages['passwordinconsistency'] = 'Les contraseñes nun concasen. Por favor, inténtalo otra vegada.'; +$messages['crypterror'] = 'Nun pudo guardase la contraseña nueva. Falta la función de cifráu.'; +$messages['connecterror'] = 'Nun pudo guardase la contraseña nueva. Fallu de conexón.'; +$messages['internalerror'] = 'Nun pudo guardase la contraseña nueva. '; +$messages['passwordshort'] = 'La contraseña tien de tener polo menos $length caráuteres.'; +$messages['passwordweak'] = 'La contraseña tien de tener polo menos un númberu y un signu de puntuación.'; +$messages['passwordforbidden'] = 'La contraseña que s\'introduxo contién caráuteres non permitíos.'; +?> diff --git a/plugins/password/localization/be_BE.inc b/plugins/password/localization/be_BE.inc new file mode 100644 index 000000000..457e67e9e --- /dev/null +++ b/plugins/password/localization/be_BE.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'Змяніць пароль'; +$labels['curpasswd'] = 'Бягучы пароль:'; +$labels['newpasswd'] = 'Новы пароль:'; +$labels['confpasswd'] = 'Паўтарыце новы пароль:'; +$messages['nopassword'] = 'Увядзіце новы пароль.'; +$messages['nocurpassword'] = 'Увядзіце бягучы пароль.'; +$messages['passwordincorrect'] = 'Няслушны бягучы пароль.'; +$messages['passwordinconsistency'] = 'Паролі не супадаюць. Паспрабуйце яшчэ раз.'; +$messages['crypterror'] = 'Не ўдалося захаваць новы пароль. Бракуе функцыі шыфравання.'; +$messages['connecterror'] = 'Не ўдалося захаваць новы пароль. Памылка злучэння.'; +$messages['internalerror'] = 'Не ўдалося захаваць новы пароль.'; +$messages['passwordshort'] = 'Пароль мусіць быць мінімум $length знакаў.'; +$messages['passwordweak'] = 'Пароль мусіць утрымліваць мінімум адну лічбу і адзін знак пунктуацыі.'; +$messages['passwordforbidden'] = 'Пароль утрымлівае забароненыя знакі.'; +?> diff --git a/plugins/password/localization/el_GR.inc b/plugins/password/localization/el_GR.inc new file mode 100644 index 000000000..b1c72ab69 --- /dev/null +++ b/plugins/password/localization/el_GR.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'Αλλαγη κωδικου προσβασης'; +$labels['curpasswd'] = 'Τρεχων κωδικος προσβασης:'; +$labels['newpasswd'] = 'Νεος κωδικος προσβασης:'; +$labels['confpasswd'] = 'Επιβεβαιωση κωδικου προσβασης:'; +$messages['nopassword'] = 'Εισαγετε εναν νεο κωδικο.'; +$messages['nocurpassword'] = 'Εισαγετε τον τρεχων κωδικο.'; +$messages['passwordincorrect'] = 'Ο τρεχων κωδικος ειναι λαθος.'; +$messages['passwordinconsistency'] = 'Οι κωδικοί πρόσβασης δεν ταιριάζουν, προσπαθήστε ξανά.'; +$messages['crypterror'] = 'Δεν μπορεσε να αποθηκεύθει ο νέος κωδικός πρόσβασης. Η λειτουργία κρυπτογράφησης λείπει.'; +$messages['connecterror'] = 'Δεν μπορεσε να αποθηκεύθει ο νέος κωδικός πρόσβασης. Σφάλμα σύνδεσης.'; +$messages['internalerror'] = 'Δεν μπορεσε να αποθηκεύθει ο νέος κωδικός πρόσβασης. '; +$messages['passwordshort'] = 'Ο κωδικός πρόσβασης πρέπει να είναι τουλάχιστον $μήκος χαρακτήρων.'; +$messages['passwordweak'] = 'Ο κωδικός πρόσβασης πρέπει να περιλαμβάνει τουλάχιστον έναν αριθμό και ένα σημείο στίξης. '; +$messages['passwordforbidden'] = 'Ο κωδικός πρόσβασης περιέχει μη επιτρεπτούς χαρακτήρες. '; +?> diff --git a/plugins/password/localization/en_US.inc b/plugins/password/localization/en_US.inc index a4c077fe5..dd57c1318 100644 --- a/plugins/password/localization/en_US.inc +++ b/plugins/password/localization/en_US.inc @@ -5,7 +5,7 @@ | plugins/password/localization/<lang>.inc | | | | Localization file of the Roundcube Webmail Password plugin | - | Copyright (C) 2012-2013, The Roundcube Dev Team | + | Copyright (C) 2012, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | diff --git a/plugins/password/localization/eu_ES.inc b/plugins/password/localization/eu_ES.inc new file mode 100644 index 000000000..b814d2983 --- /dev/null +++ b/plugins/password/localization/eu_ES.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'Pasahitza aldatu'; +$labels['curpasswd'] = 'Oraingo pasahitza:'; +$labels['newpasswd'] = 'Pasahitz berria:'; +$labels['confpasswd'] = 'Konfirmatu pasahitz berria:'; +$messages['nopassword'] = 'Sartu pasahitz berria.'; +$messages['nocurpassword'] = 'Sartu oraingo pasahitza.'; +$messages['passwordincorrect'] = 'Oraingo pasahitza ez da zuzena.'; +$messages['passwordinconsistency'] = 'Pasahitz berria ez datoz bat, saiatu berriz.'; +$messages['crypterror'] = 'Ezin izan da pasahitz berria gorde. Ez da enkriptazio funtziorik aurkitu.'; +$messages['connecterror'] = 'Ezin izan da pasahitz berria gorde. Konexio arazoak egon dira.'; +$messages['internalerror'] = 'Ezin izan da pasahitz berria gorde.'; +$messages['passwordshort'] = 'Gutxienez $length karakteretakoa izan behar du pasahitzak.'; +$messages['passwordweak'] = 'Gutxienez zenbaki bat eta puntuazio karaktere bat izan behar du pasahitzak.'; +$messages['passwordforbidden'] = 'Galarazitako karaktereak daude pasahitzean.'; +?> diff --git a/plugins/password/localization/fa_AF.inc b/plugins/password/localization/fa_AF.inc new file mode 100644 index 000000000..5bf7c3a8f --- /dev/null +++ b/plugins/password/localization/fa_AF.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'تغییر رمز عبور'; +$labels['curpasswd'] = 'رمز عبور کنونی'; +$labels['newpasswd'] = 'رمز عبور جدید'; +$labels['confpasswd'] = 'تایید رمز عبور جدید'; +$messages['nopassword'] = 'لطفا رمز عبور جدیدی وارد کنید'; +$messages['nocurpassword'] = 'لطفا رمز عبور کنونی را وارد کنید'; +$messages['passwordincorrect'] = 'رمز عبور کنونی اشتباه است'; +$messages['passwordinconsistency'] = 'رمزهای عبور با هم مطابقت ندارند، لطفا دوباره سعی کنید'; +$messages['crypterror'] = 'امکان ذخیره رمز عبور جدید وجود ندارد. تابع رمزگذاری یافت نشد'; +$messages['connecterror'] = 'امکان ذخیره رمز عبور جدید وجود ندارد. لطفا دوباره سعی کنید'; +$messages['internalerror'] = 'امکان ذخیره رمز عبور جدید وجود ندارد'; +$messages['passwordshort'] = 'طول رمز عبور می بایست حداقل به طول $length کاراکتر باشد'; +$messages['passwordweak'] = 'رمز عبور می بایست دارای حداقل یک عدد و یک کاراکتر علامت گذاری باشد'; +$messages['passwordforbidden'] = 'رمز عبور شامل کاراکترهای غیر مجاز است'; +?> diff --git a/plugins/password/localization/gl_ES.inc b/plugins/password/localization/gl_ES.inc index 93c505a6a..245d1c634 100644 --- a/plugins/password/localization/gl_ES.inc +++ b/plugins/password/localization/gl_ES.inc @@ -26,7 +26,7 @@ $messages = array(); $messages['nopassword'] = 'Por favor, introduza un contrasinal novo.'; $messages['nocurpassword'] = 'Por favor, introduza o contrasinal actual.'; $messages['passwordincorrect'] = 'O contrasinal actual é incorrecto.'; -$messages['passwordinconsistency'] = 'Os contrasinais non cadran. Por favor, inténteo outra vez.'; +$messages['passwordinconsistency'] = 'Os contrasinals non coinciden. Por favor, inténteo de novo.'; $messages['crypterror'] = 'Non foi posible gardar o contrasinal novo. Falta a función de cifrado.'; $messages['connecterror'] = 'Non foi posible gardar o contrasinal novo. Erro de conexión'; $messages['internalerror'] = 'Non foi posible gardar o contrasinal novo.'; diff --git a/plugins/password/localization/lb_LU.inc b/plugins/password/localization/lb_LU.inc index 9962aed28..08026f242 100644 --- a/plugins/password/localization/lb_LU.inc +++ b/plugins/password/localization/lb_LU.inc @@ -15,14 +15,10 @@ For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ */ - -$labels = array(); $labels['changepasswd'] = 'Passwuert änneren'; $labels['curpasswd'] = 'Aktuellt Passwuert:'; $labels['newpasswd'] = 'Neit Passwuert:'; $labels['confpasswd'] = 'Neit Passwuert bestätegen:'; - -$messages = array(); $messages['nopassword'] = 'Gëff wann ech gelift en neit Passwuert an.'; $messages['nocurpassword'] = 'Gëff wann ech gelift dat aktuellt Passwuert an.'; $messages['passwordincorrect'] = 'Aktuellt Passwuert net korrekt.'; @@ -33,5 +29,4 @@ $messages['internalerror'] = 'Neit Passwuert konnt net gespäichert ginn.'; $messages['passwordshort'] = 'D\'Passwuert muss mindestens $length Zeeche laang sinn.'; $messages['passwordweak'] = 'D\'Passwuert muss mindestens eng Zuel an ee Sazzeechen enthalen.'; $messages['passwordforbidden'] = 'D\'Passwuert enthält verbueden Zeechen.'; - ?> diff --git a/plugins/password/localization/lv_LV.inc b/plugins/password/localization/lv_LV.inc index ac0e5da79..650d31b2c 100644 --- a/plugins/password/localization/lv_LV.inc +++ b/plugins/password/localization/lv_LV.inc @@ -20,18 +20,18 @@ $labels = array(); $labels['changepasswd'] = 'Nomainīt paroli'; $labels['curpasswd'] = 'Pašreizējā parole:'; $labels['newpasswd'] = 'Jaunā parole:'; -$labels['confpasswd'] = 'Apstiprināt jauno paroli:'; +$labels['confpasswd'] = 'Vēlreiz jauno paroli:'; $messages = array(); -$messages['nopassword'] = 'Lūdzu ievadiet jauno paroli.'; -$messages['nocurpassword'] = 'Lūdzu ievadiet pašreizējo paroli.'; -$messages['passwordincorrect'] = 'Pašreizējā parole nav pareiza.'; +$messages['nopassword'] = 'Lūdzu, ievadiet jauno paroli.'; +$messages['nocurpassword'] = 'Lūdzu, ievadiet pašreizējo paroli.'; +$messages['passwordincorrect'] = 'Pašreizējā parole nepareiza.'; $messages['passwordinconsistency'] = 'Paroles nesakrīt. Lūdzu, ievadiet vēlreiz.'; -$messages['crypterror'] = 'Nevarēja saglabāt jauno paroli. Trūkst kriptēšanas funkcijas.'; +$messages['crypterror'] = 'Nevarēja saglabāt jauno paroli. Trūkst kriptēšanas funkcija.'; $messages['connecterror'] = 'Nevarēja saglabāt jauno paroli. Savienojuma kļūda.'; $messages['internalerror'] = 'Nevarēja saglabāt jauno paroli.'; -$messages['passwordshort'] = 'Jaunajai parolei jābūt vismaz $length simbolu garai.'; -$messages['passwordweak'] = 'Jaunajai parolei jāsatur vismaz viens cipars un speciālais simbols.'; -$messages['passwordforbidden'] = 'Parole satur neatļautus simbolus.'; +$messages['passwordshort'] = 'Jaunajai parolei jābūt vismaz $length simbola garai.'; +$messages['passwordweak'] = 'Jaunajai parolei jāsatur vismaz viens cipars un punktuācijas simbols.'; +$messages['passwordforbidden'] = 'Password contains forbidden characters.'; ?> diff --git a/plugins/password/localization/ro_RO.inc b/plugins/password/localization/ro_RO.inc index 7406efb9a..17ec31c6b 100644 --- a/plugins/password/localization/ro_RO.inc +++ b/plugins/password/localization/ro_RO.inc @@ -20,18 +20,18 @@ $labels = array(); $labels['changepasswd'] = 'Schimbați parola'; $labels['curpasswd'] = 'Parola curentă:'; $labels['newpasswd'] = 'Parola nouă:'; -$labels['confpasswd'] = 'Confirmați parola nouă:'; +$labels['confpasswd'] = 'Confirmare parola nouă:'; $messages = array(); $messages['nopassword'] = 'Te rog să introduci noua parolă.'; $messages['nocurpassword'] = 'Te rog să introduci parola curentă'; $messages['passwordincorrect'] = 'Parola curentă este incorectă.'; -$messages['passwordinconsistency'] = 'Parolele nu se potrivesc, vă rugăm să mai încercați'; -$messages['crypterror'] = 'Nu am reușit să salvez noua parolă. Lipsa funcției de criptare.'; +$messages['passwordinconsistency'] = 'Parolele nu se potrivesc, te rog să mai încerci'; +$messages['crypterror'] = 'Nu am reușit să salvez noua parolă. Funcția de criptare lipsește.'; $messages['connecterror'] = 'Nu am reușit să salvez noua parolă. Eroare connexiune.'; $messages['internalerror'] = 'Nu am reușit să salvez noua parolă.'; -$messages['passwordshort'] = 'Parola trebuie să aibă $length caractere.'; -$messages['passwordweak'] = 'Parola trebuie să conțina cel puțin un număr si un semn de punctuație'; +$messages['passwordshort'] = 'Parola trebuie să aibă minim $length caractere.'; +$messages['passwordweak'] = 'Parola trebuie să conțina cel puțin un număr si un semn de punctuație.'; $messages['passwordforbidden'] = 'Parola conține caractere nepermise.'; ?> diff --git a/plugins/password/localization/ru_RU.inc b/plugins/password/localization/ru_RU.inc index 2517f922b..79fbfedf6 100644 --- a/plugins/password/localization/ru_RU.inc +++ b/plugins/password/localization/ru_RU.inc @@ -26,11 +26,11 @@ $messages = array(); $messages['nopassword'] = 'Пожалуйста, введите новый пароль.'; $messages['nocurpassword'] = 'Пожалуйста, введите текущий пароль.'; $messages['passwordincorrect'] = 'Текущий пароль неверен.'; -$messages['passwordinconsistency'] = 'Пароли не совпадают, попробуйте ещё раз, пожалуйста.'; +$messages['passwordinconsistency'] = 'Пароли не совпадают, попробуйте, пожалуйста, ещё.'; $messages['crypterror'] = 'Не могу сохранить новый пароль. Отсутствует криптографическая функция.'; $messages['connecterror'] = 'Не могу сохранить новый пароль. Ошибка соединения.'; $messages['internalerror'] = 'Не могу сохранить новый пароль.'; -$messages['passwordshort'] = 'Длина пароля должна быть как минимум $length символов.'; +$messages['passwordshort'] = 'Пароль должен быть длиной как минимум $length символов.'; $messages['passwordweak'] = 'Пароль должен включать в себя как минимум одну цифру и один знак пунктуации.'; $messages['passwordforbidden'] = 'Пароль содержит недопустимые символы.'; diff --git a/plugins/password/localization/ti.inc b/plugins/password/localization/ti.inc new file mode 100644 index 000000000..9453318f0 --- /dev/null +++ b/plugins/password/localization/ti.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'መሕለፊ ቃል ይለወጥ'; +$labels['curpasswd'] = 'ህልው መሕለፊ ቃል:'; +$labels['newpasswd'] = 'ሓዱሽ መሕለፊ ቃል:'; +$labels['confpasswd'] = 'መረጋገፂ ሓዱሽ መሕለፊ ቃል :'; +$messages['nopassword'] = 'ሓዱሽ መሕለፊ ቃል አብዚ ይእቶ::'; +$messages['nocurpassword'] = 'ህልው መሕለፊ ቃል ኣብዚ ይእቶ::'; +$messages['passwordincorrect'] = 'ህልው መሕለፊ ቃል ከምኡ ኣይኮነን::'; +$messages['passwordinconsistency'] = 'መሕለፍቲ ቃላት ሓድ ኣይኮኑን ::ተውሳኺ ፈተነ የድሊ::'; +$messages['crypterror'] = 'መመስጥሪ ፋንክሽን ስለዝሳእነ እቲ መሕለፊ ቃል ኣይተቐመጠን::'; +$messages['connecterror'] = 'ናይ ርክብ ጸገም ስለዘሎ እቲ መሕለፊ ቃል ኣይተቐመጠን::'; +$messages['internalerror'] = 'እቲ መሕለፊ ቃል ኣይተቐመጠን::'; +$messages['passwordshort'] = 'ንውሓት መሕለፊ ቃል $length ፊዳላት ክኾን አለዎ::'; +$messages['passwordweak'] = 'መሕለፊ ቃል እንተውሓደ ሓደ ኣሃዝን ሓደ ስርዓተ ነጥብን ከጠቓልል አለዎ::'; +$messages['passwordforbidden'] = 'እቲ መሕለፊ ቃል ውጉዳት ፊዳላት አለውዎ::'; +?> diff --git a/plugins/password/localization/uk_UA.inc b/plugins/password/localization/uk_UA.inc new file mode 100644 index 000000000..0d102e528 --- /dev/null +++ b/plugins/password/localization/uk_UA.inc @@ -0,0 +1,32 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | plugins/password/localization/<lang>.inc | + | | + | Localization file of the Roundcube Webmail Password plugin | + | Copyright (C) 2012-2013, The Roundcube Dev Team | + | | + | Licensed under the GNU General Public License version 3 or | + | any later version with exceptions for skins & plugins. | + | See the README file for a full license statement. | + | | + +-----------------------------------------------------------------------+ + + For translation see https://www.transifex.com/projects/p/roundcube-webmail/resource/plugin-password/ +*/ +$labels['changepasswd'] = 'Змінити пароль'; +$labels['curpasswd'] = 'Поточний пароль:'; +$labels['newpasswd'] = 'Новий пароль:'; +$labels['confpasswd'] = 'Підтвердіть новий пароль:'; +$messages['nopassword'] = 'Будь ласка, введіть новий пароль.'; +$messages['nocurpassword'] = 'Будь ласка, введіть поточний пароль.'; +$messages['passwordincorrect'] = 'Поточний пароль неправильний.'; +$messages['passwordinconsistency'] = 'Паролі не збігаються, спробуйте ще раз.'; +$messages['crypterror'] = 'Не вдалося зберегти новий пароль. Функція шифрування відсутня.'; +$messages['connecterror'] = 'Не вдалося зберегти новий пароль. Помилка з\'єднання.'; +$messages['internalerror'] = 'Не вдалося зберегти новий пароль.'; +$messages['passwordshort'] = 'Пароль повинен бути не менше $length символів.'; +$messages['passwordweak'] = 'Пароль повинен містити як мінімум одну цифру і один розділовий знак.'; +$messages['passwordforbidden'] = 'Пароль містить заборонені символи.'; +?> diff --git a/plugins/password/package.xml b/plugins/password/package.xml index 16eda1ad0..9a056dec6 100644 --- a/plugins/password/package.xml +++ b/plugins/password/package.xml @@ -15,18 +15,19 @@ <email>alec@alec.pl</email> <active>yes</active> </lead> - <date>2013-04-28</date> + <date>2012-11-15</date> <version> - <release>3.4</release> + <release>3.2</release> <api>2.0</api> </version> <stability> <release>stable</release> <api>stable</api> </stability> - <license uri="http://www.gnu.org/licenses/gpl.html">GNU GPLv3+</license> + <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> <notes> -Added password_force_save option +- Fix wrong (non-specific) error message on crypt or connection error (#1488808) +- Added option to define IMAP hosts that support password changes - password_hosts </notes> <contents> <dir baseinstalldir="/" name="/"> @@ -346,36 +347,5 @@ Added password_force_save option - Added Samba password (#1488364) </notes> </release> - <release> - <date>2012-11-15</date> - <version> - <release>3.2</release> - <api>2.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> - <notes> -- Fix wrong (non-specific) error message on crypt or connection error (#1488808) -- Added option to define IMAP hosts that support password changes - password_hosts - </notes> - </release> - <release> - <date>2013-03-30</date> - <version> - <release>3.3</release> - <api>2.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> - <notes> -Added new cPanel driver - fixes localization related issues (#1487015) - </notes> - </release> </changelog> </package> diff --git a/plugins/password/password.php b/plugins/password/password.php index f1a3e17b9..806db0586 100644 --- a/plugins/password/password.php +++ b/plugins/password/password.php @@ -1,26 +1,32 @@ <?php -/** - * Password Plugin for Roundcube - * - * @version @package_version@ - * @author Aleksander Machniak <alec@alec.pl> - * - * Copyright (C) 2005-2013, The Roundcube Dev Team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - */ +/* + +-------------------------------------------------------------------------+ + | Password Plugin for Roundcube | + | @version @package_version@ | + | | + | Copyright (C) 2009-2010, Roundcube Dev. | + | | + | This program is free software; you can redistribute it and/or modify | + | it under the terms of the GNU General Public License version 2 | + | as published by the Free Software Foundation. | + | | + | This program is distributed in the hope that it will be useful, | + | but WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | + | GNU General Public License for more details. | + | | + | You should have received a copy of the GNU General Public License along | + | with this program; if not, write to the Free Software Foundation, Inc., | + | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | + | | + +-------------------------------------------------------------------------+ + | Author: Aleksander Machniak <alec@alec.pl> | + +-------------------------------------------------------------------------+ + + $Id: index.php 2645 2009-06-15 07:01:36Z alec $ + +*/ define('PASSWORD_CRYPT_ERROR', 1); define('PASSWORD_ERROR', 2); @@ -106,22 +112,22 @@ class password extends rcube_plugin $rc_charset = strtoupper($rcmail->output->get_charset()); $sespwd = $rcmail->decrypt($_SESSION['password']); - $curpwd = $confirm ? rcube_utils::get_input_value('_curpasswd', rcube_utils::INPUT_POST, true, $charset) : $sespwd; - $newpwd = rcube_utils::get_input_value('_newpasswd', rcube_utils::INPUT_POST, true); - $conpwd = rcube_utils::get_input_value('_confpasswd', rcube_utils::INPUT_POST, true); + $curpwd = $confirm ? get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset) : $sespwd; + $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST, true); + $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST, true); // check allowed characters according to the configured 'password_charset' option // by converting the password entered by the user to this charset and back to UTF-8 $orig_pwd = $newpwd; - $chk_pwd = rcube_charset::convert($orig_pwd, $rc_charset, $charset); - $chk_pwd = rcube_charset::convert($chk_pwd, $charset, $rc_charset); + $chk_pwd = rcube_charset_convert($orig_pwd, $rc_charset, $charset); + $chk_pwd = rcube_charset_convert($chk_pwd, $charset, $rc_charset); // WARNING: Default password_charset is ISO-8859-1, so conversion will // change national characters. This may disable possibility of using // the same password in other MUA's. // We're doing this for consistence with Roundcube core - $newpwd = rcube_charset::convert($newpwd, $rc_charset, $charset); - $conpwd = rcube_charset::convert($conpwd, $rc_charset, $charset); + $newpwd = rcube_charset_convert($newpwd, $rc_charset, $charset); + $conpwd = rcube_charset_convert($conpwd, $rc_charset, $charset); if ($chk_pwd != $orig_pwd) { $rcmail->output->command('display_message', $this->gettext('passwordforbidden'), 'error'); @@ -135,13 +141,13 @@ class password extends rcube_plugin } else if ($required_length && strlen($newpwd) < $required_length) { $rcmail->output->command('display_message', $this->gettext( - array('name' => 'passwordshort', 'vars' => array('length' => $required_length))), 'error'); + array('name' => 'passwordshort', 'vars' => array('length' => $required_length))), 'error'); } 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 - else if ($sespwd == $newpwd && !$rcmail->config->get('password_force_save')) { + else if ($sespwd == $newpwd) { $rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation'); } // try to save the password @@ -157,8 +163,8 @@ class password extends rcube_plugin // Log password change if ($rcmail->config->get('password_log')) { - 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())); + write_log('password', sprintf('Password changed for user %s (ID: %d) from %s', + $rcmail->get_user_name(), $rcmail->user->ID, rcmail_remote_ip())); } } else { @@ -166,7 +172,7 @@ class password extends rcube_plugin } } - $rcmail->overwrite_action('plugin.password'); + rcmail_overwrite_action('plugin.password'); $rcmail->output->send('plugin'); } @@ -191,7 +197,7 @@ class password extends rcube_plugin $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); - $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd')))); + $table->add('title', html::label($field_id, Q($this->gettext('curpasswd')))); $table->add(null, $input_curpasswd->show()); } @@ -200,7 +206,7 @@ class password extends rcube_plugin $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); - $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd')))); + $table->add('title', html::label($field_id, Q($this->gettext('newpasswd')))); $table->add(null, $input_newpasswd->show()); // show confirm password selection @@ -208,7 +214,7 @@ class password extends rcube_plugin $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off')); - $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd')))); + $table->add('title', html::label($field_id, Q($this->gettext('confpasswd')))); $table->add(null, $input_confpasswd->show()); $out = html::div(array('class' => 'box'), @@ -240,7 +246,7 @@ class password extends rcube_plugin $file = $this->home . "/drivers/$driver.php"; if (!file_exists($file)) { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, @@ -252,7 +258,7 @@ class password extends rcube_plugin include_once $file; if (!class_exists($class, false) || !method_exists($class, 'save')) { - rcube::raise_error(array( + raise_error(array( 'code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, |