From 6934b88d5dc03182598b5f104765d707e901ce1a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 1 Apr 2011 18:50:17 +0000 Subject: [PATCH] added "must change password" and "can change password" attribute to "Bulk password reset" command and added German translation --- admin/inc/class.admin_passwordreset.inc.php | 47 +++++++++++++------ .../class.admin_prefs_sidebox_hooks.inc.php | 2 +- admin/lang/egw_de.lang | 27 +++++++++++ admin/lang/egw_en.lang | 27 +++++++++++ admin/setup/etemplates.inc.php | 4 +- 5 files changed, 90 insertions(+), 17 deletions(-) diff --git a/admin/inc/class.admin_passwordreset.inc.php b/admin/inc/class.admin_passwordreset.inc.php index 97dad353c8..98c01faa39 100644 --- a/admin/inc/class.admin_passwordreset.inc.php +++ b/admin/inc/class.admin_passwordreset.inc.php @@ -42,9 +42,10 @@ class admin_passwordreset $GLOBALS['egw']->redirect_link('/index.php'); } $this->replacements = array( - 'account_lid' => lang('Login-ID'), - 'account_firstname' => lang('firstname'), - 'account_lastname' => lang('lastname'), + 'account_lid' => lang('LoginID'), + 'account_firstname' => lang('first name'), + 'account_lastname' => lang('last name'), + 'account_fullname' => lang('full name'), 'account_email' => lang('email'), 'account_password' => lang('new password'), 'account_id' => lang('nummeric account ID'), @@ -84,12 +85,10 @@ class admin_passwordreset { $msg = lang('You need to select some users first!'); } - elseif (!$content['random_pw'] && !$content['hash'] && !$content['notify']) + elseif (!$content['random_pw'] && !$content['hash'] && !$content['notify'] && + (string)$content['changepassword'] === '' && (string)$content['mustchangepassword'] === '') { - $msg = lang('You need to check "%1", "%2" or select any from "%3"!', - lang('Set a random password'), - lang('Notify user by email'), - lang('Change password hash to')); + $msg = lang('You need to select as least one action!'); } elseif(!$content['random_pw'] && $content['hash'] && $content['hash'] != $current_hash && $current_hash != 'plain') { @@ -103,19 +102,19 @@ class admin_passwordreset $msg = lang('Changed password hash for %1 to %2.',strtoupper($account_repository),$content['hash'])."\n"; $GLOBALS['egw_info']['server'][$account_repository.'_encryption_type'] = $content['hash']; } + $change_pw = $content['random_pw'] || $content['hash'] && $content['hash'] != $current_hash; $changed = array(); foreach($content['users'] as $account_id) { if (($account = $GLOBALS['egw']->accounts->read($account_id))) { //_debug_array($account); //break; - if ($content['random_pw']) { $password = auth::randomstring(8); $old_password = null; } - elseif (!preg_match('/^{plain}/i',$account['account_pwd']) && + elseif ($change_pw && !preg_match('/^{plain}/i',$account['account_pwd']) && ($current_hash != 'plain' || $current_hash == 'plain' && $account['account_pwd'][0] == '{')) { $msg .= lang('Account "%1" has NO plaintext password!',$account['account_lid'])."\n"; @@ -125,11 +124,30 @@ class admin_passwordreset { $old_password = $password = preg_replace('/^{plain}/i','',$account['account_pwd']); } - if (!$GLOBALS['egw']->auth->change_password($old_password,$password,$account_id)) + // change password, if requested + if ($change_pw && !$GLOBALS['egw']->auth->change_password($old_password,$password,$account_id)) { $msg .= lang('Failed to change password for account "%1"!',$account['account_lid'])."\n"; continue; } + // force password change on next login + if ((string)$content['mustchangepassword'] !== '' && !(!$content['mustchangepassword'] && $change_pw)) + { + $GLOBALS['egw']->auth->setLastPwdChange($account_id, $password, + $content['mustchangepassword'] ? 0 : time()); + } + // allow or forbid to change password, if requested + if ((string)$content['changepassword'] !== '') + { + if(!$content['changepassword']) + { + $GLOBALS['egw']->acl->add_repository('preferences','nopasswordchange',$account_id,1); + } + else + { + $GLOBALS['egw']->acl->delete_repository('preferences','nopasswordchange',$account_id); + } + } $account['account_password'] = $password; $changed[] = $account; @@ -168,16 +186,17 @@ class admin_passwordreset } if ($changed) { - $msg .= lang('Passwords of %1 accounts changed',count($changed)); + $msg .= lang('Passwords and/or attributes of %1 accounts changed',count($changed)); } } } $content['msg'] = $msg; $content['account_repository'] = $account_repository; - $content['current_hash'] = $current_hash; + $content['current_hash'] = $content['hash'] ? $content['hash'] : $current_hash; $sel_options['hash'] = $account_repository == 'sql' ? sql_passwdhashes($GLOBALS['egw_info']['server'],true) : passwdhashes($GLOBALS['egw_info']['server'],true); + $content['replacements'] = array(); foreach($this->replacements as $name => $label) { @@ -188,7 +207,7 @@ class admin_passwordreset } $readonlys['download_csv'] = !$changed; - $GLOBALS['egw_info']['flags']['app_header'] = lang('Reset passwords'); + $GLOBALS['egw_info']['flags']['app_header'] = lang('Bulk password reset'); $tmpl = new etemplate('admin.passwordreset'); $tmpl->exec('admin.admin_passwordreset.index',$content,$sel_options,$readonlys,array( diff --git a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php index 7d48f190d8..ea5679a2e3 100644 --- a/admin/inc/class.admin_prefs_sidebox_hooks.inc.php +++ b/admin/inc/class.admin_prefs_sidebox_hooks.inc.php @@ -59,7 +59,7 @@ class admin_prefs_sidebox_hooks if (! $GLOBALS['egw']->acl->check('account_access',16,'admin')) { - $file['Reset passwords'] = egw::link('/index.php','menuaction=admin.admin_passwordreset.index'); + $file['Bulk password reset'] = egw::link('/index.php','menuaction=admin.admin_passwordreset.index'); } if (! $GLOBALS['egw']->acl->check('group_access',1,'admin')) diff --git a/admin/lang/egw_de.lang b/admin/lang/egw_de.lang index 99e9a01f7d..cc70b81156 100644 --- a/admin/lang/egw_de.lang +++ b/admin/lang/egw_de.lang @@ -13,6 +13,8 @@ (to install new applications use
setup [manage applications] !!!) admin de (Zur Installation neuer Anwendungen verwenden Sie bitte
Setup [Anwendungen Verwalten] !!!) - type admin de -Typ accesslog and bruteforce defense admin de Zugangsprotokoll und Abwehr von Brute-Force-Angriffen +account "%1" has no email address --> not notified! admin de Benutzer "%1" hat keine EMail Adresse --> nicht benachrichtigt! +account "%1" has no plaintext password! admin de Benutzer "%1" hat kein Klartext Passwort! account %1 %2 admin de Benutzerkonto %1 %2 account '%1' deleted. admin de Benutzerkonto '%1' gelöscht. account active admin de Konto aktiv @@ -54,6 +56,7 @@ advanced options admin de erweiterte Optionen after how many unsuccessful attempts to login, an account should be blocked (default 3) ? admin de Nach wievielen erfolglosen Anmeldeversuchen soll ein Benutzerkonto gesperrt werden (Vorgabe 3)? after how many unsuccessful attempts to login, an ip should be blocked (default 3) ? admin de Nach wievielen erfolglosen Anmeldeversuchen soll eine IP-Adresse gesperrt werden (Vorgabe 3)? aliases admin de E-Mail-Alias +all applications admin de Alle Anwendungen all records and account information will be lost! admin de Alle Datensätze und Kontoinformationen sind dann verloren! all users admin de Alle Benutzer allow anonymous access to this app admin de Anonymen Zugriff auf diese Anwendung zulassen @@ -92,10 +95,12 @@ attribute mailalternateaddress explained admin de Dies betrifft das Attribut attribute mailforwardingaddress explained admin de Dies betrifft das Attribut -mailForwardingAddress- aus dem QMAIL Schema. Darf nicht leer sein. Der Begriff mailRoutingAddress wurde hierfür früher als Alias verwendet. authentication / accounts admin de Benutzerauthentifizierung / Benutzerkonten auto create account records for authenticated users admin de Automatisch Benutzerkonten für authentifizierte Benutzer anlegen +available placeholders admin de Verfügbare Platzhalter back to the list admin de zurück zur Liste bi-dir passthrough admin de Weiterleitung in beide Richtungen bi-directional admin de beide Richtungen bottom admin de unten +bulk password reset admin de Rücksetzen mehrerer Passwörter calculate next run admin de nächste Ausführung berechnen calendar recurrence horizont in days (default 1000) admin de Kalender Wiederholungs Bereich in Tagen (Vorgabe sind 1000) can change password admin de darf Passwort ändern @@ -111,6 +116,7 @@ change acl rights admin de ACL-Rechte ändern change config settings admin de Konfiguration der Anwendung ändern change main screen message admin de Nachricht der Startseite ändern change password for %1 admin de Ändern des Passworts für %1 +change password hash to admin de Passwort Verschlüsselung ändern zu check acl for entries of not (longer) existing accounts admin de Prüfe ACL Einträge auf Bezüge zu nicht (mehr) existierenden Benutzerkonten check ip address of all sessions admin de IP-Adresse für alle Sessions überprüfen check items to %1 to %2 for %3 admin de Durch Abhaken %3 in %2 %1 @@ -132,6 +138,7 @@ creates / updates user accounts from csv file admin de Erstellt / aktualisiert B creates / updates user groups from csv file admin de Erstellt / aktualisiert Benutzergruppen durch Import von Daten aus einer CSV Datei creates a new field admin de erstellt ein neues Feld crontab only (recomended) admin de nur Crontab (empfohlen) +current hash admin de Aktuelle Verschlüsselung custom fields admin de Benutzerdefinierte Felder cyrus imap server admin de Cyrus IMAP Server data admin de Daten @@ -187,6 +194,8 @@ do you also want to delete all global subcategories ? admin de Wollen Sie auch a do you want to delete all global subcategories ? admin de Möchten Sie alle Globale Unterkategorien löschen? do you want to move all global subcategories one level down ? admin de Wollen Sie alle globalen Unterkategorien eine Ebene nach unten verschieben? document root (default) admin de Wurzelverzeichnis des Webservers (Vorgabe) +down admin de unten +download csv admin de CSV herunterladen each value is a line like [=