allow to change mail domain

This commit is contained in:
Ralf Becker 2013-04-05 14:13:41 +00:00
parent e9604992a7
commit 697d8931eb
5 changed files with 54 additions and 27 deletions

View File

@ -86,7 +86,8 @@ class admin_passwordreset
}
elseif (!$content['random_pw'] && !$content['hash'] && !$content['notify'] &&
(string)$content['changepassword'] === '' && (string)$content['mustchangepassword'] === '' &&
(string)$content['mail']['activate'] === '' && (string)$content['mail']['quota'] === '')
(string)$content['mail']['activate'] === '' && (string)$content['mail']['quota'] === '' &&
strpos($content['mail']['domain'], '.') === false)
{
$msg = lang('You need to select as least one action!');
}
@ -149,6 +150,41 @@ class admin_passwordreset
}
}
$account['account_password'] = $password;
if ((string)$content['mail']['activate'] !== '' || (string)$content['mail']['quota'] !== '')
{
if (!isset($emailadmin))
{
$emailadmin = new emailadmin_bo();
$domain = $GLOBALS['egw_info']['server']['mail_suffix'];
}
if (($userData = $emailadmin->getUserData ($account_id)))
{
if ((string)$content['mail']['activate'] !== '')
{
$userData['accountStatus'] = $content['mail']['activate'] ? 'active' : '';
}
if ((string)$content['mail']['quota'] !== '')
{
$userData['quotaLimit'] = $content['mail']['quota'];
}
if (strpos($content['mail']['domain'], '.') !== false)
{
$userData['mailLocalAddress'] = preg_replace('/@'.preg_quote($domain).'$/', '@'.$content['mail']['domain'], $userData['mailLocalAddress']);
foreach($userData['mailAlternateAddress'] as &$alias)
{
$alias = preg_replace('/@'.preg_quote($domain).'$/', '@'.$content['mail']['domain'], $alias);
}
}
$emailadmin->saveUserData($account_id, $userData);
}
}
else
{
$msg .= lang('No profile defined for user %1', '#'.$account_id.' '.$account['account_fullname']."\n");
continue;
}
$changed[] = $account;
if ($content['notify'])
@ -182,29 +218,6 @@ class admin_passwordreset
': '.strip_tags(str_replace('<p>',"\n",$send->ErrorInfo))."\n";
}
}
if ((string)$content['mail']['activate'] !== '' || (string)$content['mail']['quota'] !== '')
{
if (!isset($emailadmin))
{
$emailadmin = new emailadmin_bo();
}
if (($userData = $emailadmin->getUserData ($account_id)))
{
if ((string)$content['mail']['activate'] !== '')
{
$userData['accountStatus'] = $content['mail']['activate'] ? 'active' : '';
}
if ((string)$content['mail']['quota'] !== '')
{
$userData['quotaLimit'] = $content['mail']['quota'];
}
$emailadmin->saveUserData($account_id, $userData);
}
}
else
{
$msg .= lang('No profile defined for user %1', '#'.$account_id.' '.$account['account_fullname']);
}
}
}
if ($changed)
@ -219,6 +232,7 @@ class admin_passwordreset
$sel_options['hash'] = $account_repository == 'sql' ?
sql_passwdhashes($GLOBALS['egw_info']['server'],true) :
passwdhashes($GLOBALS['egw_info']['server'],true);
$sel_options['activate'] = array('Deactivate','Activate');
$content['replacements'] = array();
foreach($this->replacements as $name => $label)

View File

@ -35,6 +35,7 @@ acl manager admin de ACL-Manager
acl rights common de ACL-Rechte
action admin de Befehl
actions admin de Befehle
activate admin de Aktivieren
activate wysiwyg-editor admin de WYSIWYG Editor (formatierter Text) aktivieren
add a category admin de Eine Kategorie hinzufügen
add a group admin de Eine Gruppe hinzufügen
@ -122,6 +123,7 @@ category saved. admin de Kategorie gespeichert
change account_id admin de Änderung der account_id
change acl rights admin de ACL-Rechte ändern
change config settings admin de Konfiguration der Anwendung ändern
change domain of email address and aliases admin de ändert Domain von EMail Adressen oder Aliasen
change main screen message admin de Nachricht der Startseite ändern
change owner admin de Besitzer ändern
change password for %1 admin de Ändern des Passworts für %1
@ -158,6 +160,7 @@ data admin de Daten
day admin de Tag
day of week<br>(0-6, 0=sun) admin de Wochentag<br>(0-6, 0=Sonntag)
db backup and restore admin de DB Datensicherung und Wiederherstellung
deactivate admin de Deaktivieren
default admin de Vorgabe
default file system space per user admin de Vorgabewert für Dateisystemplatz pro Benutzer
default file system space per user/group ? admin de Vorgabewert für Dateisystemplatz pro Benutzer/Gruppe verwenden?
@ -235,6 +238,7 @@ egroupware version admin de EGroupware Version
either install id and config password needed or the remote hash! admin de Sie benötigen entweder die Install ID UND das Konfigurationspasswort ODER den Remote Hash!
email account active admin de E-Mail-Konto aktiv
email address admin de E-Mail-Adresse
empty to not change admin de leer lassen um NICHT zu ändern
enable admin de einschalten
enable debug-messages admin de Debug-Meldungen einschalten
enable the soap service admin de soap Service einschalten
@ -385,6 +389,7 @@ login-status admin de Angemeldet-Status
loginid admin de Login-ID
logintime admin de Anmeldezeit
logoutime admin de Abmeldezeit
mail account admin de EMail Konto
mail settings admin de E-Mail-Einstellungen
main email-address admin de Stamm-E-Mail-Adresse
main screen message admin de Nachricht der Startseite

View File

@ -35,6 +35,7 @@ acl manager admin en ACL manager
acl rights common en ACL rights
action admin en Action
actions admin en Actions
activate admin en Activate
activate wysiwyg-editor admin en Activate WYSIWYG-editor
add a category admin en Add a category
add a group admin en Add a group
@ -122,6 +123,7 @@ category saved. admin en Category saved.
change account_id admin en Change account ID
change acl rights admin en Change ACL rights
change config settings admin en Change config settings
change domain of email address and aliases admin en change domain of email address and aliases
change main screen message admin en Change main screen message
change owner admin en Change owner
change password for %1 admin en Change password for %1
@ -158,6 +160,7 @@ data admin en Data
day admin en Day
day of week<br>(0-6, 0=sun) admin en Day of week<br>(0-6, 0=Sun)
db backup and restore admin en DB backup and restore
deactivate admin en Deactivate
default admin en Default
default file system space per user admin en Default file system space per user
default file system space per user/group ? admin en Default file system space per user/group?
@ -236,6 +239,7 @@ egroupware version admin en EGroupware version
either install id and config password needed or the remote hash! admin en Either install ID AND config password needed OR the remote hash!
email account active admin en Email account active
email address admin en Email address
empty to not change admin en empty to NOT change
enable admin en Enable
enable debug-messages admin en Enable debug messages.
enable the soap service admin en Enable the soap service.
@ -386,6 +390,7 @@ login-status admin en Login status
loginid admin en Login ID
logintime admin en Login time
logoutime admin en Logout time
mail account admin en Mail account
mail settings admin en Mail settings
main email-address admin en Main email address
main screen message admin en Main screen message

View File

@ -2,7 +2,7 @@
/**
* EGroupware - eTemplates for Application admin
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2013-04-05 14:50
* generated by soetemplate::dump4setup() 2013-04-05 16:12
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package admin
@ -93,7 +93,7 @@ $templ_data[] = array('name' => 'admin.customtranslation','template' => '','lang
$templ_data[] = array('name' => 'admin.export_users_csv_selectors','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:10:"All,groups";s:5:"label";s:5:"Group";s:4:"name";s:8:"group_id";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"name";s:9:"selection";s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1302620448',);
$templ_data[] = array('name' => 'admin.passwordreset','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:2:{s:2:"h1";s:6:",!@msg";s:2:"c5";s:4:",top";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Select users";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:2:"15";s:4:"name";s:5:"users";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:9:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"6";s:5:"label";s:7:"Actions";i:1;a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:21:"Set a random password";s:4:"name";s:9:"random_pw";}i:2;a:5:{s:4:"type";s:11:"select-bool";s:4:"size";s:15:"Leave unchanged";s:5:"label";s:36:"Must change password upon next login";s:4:"name";s:18:"mustchangepassword";s:8:"onchange";s:85:"if (this.value==\'1\') document.getElementById(form::name(\'changepassword\')).value=\'1\';";}i:3;a:5:{s:4:"type";s:11:"select-bool";s:4:"size";s:15:"Leave unchanged";s:5:"label";s:19:"Can change password";s:4:"name";s:14:"changepassword";s:8:"onchange";s:136:"var mustchange=document.getElementById(form::name(\'mustchangepassword\')); if (this.value==\'0\' && mustchange.value) mustchange.value=\'0\';";}i:4;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:4:{s:4:"type";s:6:"select";s:4:"size";s:15:"Leave unchanged";s:4:"name";s:4:"hash";s:5:"label";s:23:"Change password hash to";}i:2;a:5:{s:4:"type";s:4:"text";s:5:"label";s:12:"Current hash";s:4:"name";s:12:"current_hash";s:4:"span";s:14:",leftPad5 gray";s:8:"readonly";s:1:"1";}}i:5;a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:20:"Notify user by email";s:4:"name";s:6:"notify";}i:6;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:11:"select-bool";s:4:"name";s:14:"mail[activate]";s:4:"size";s:15:"Leave unchanged";s:5:"label";s:21:"Activate mail account";}i:2;a:4:{s:4:"type";s:3:"int";s:4:"name";s:11:"mail[quota]";s:5:"label";s:10:"Quota (MB)";s:4:"help";s:20:"|empty to NOT change";}}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:5:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"2";s:5:"label";s:17:"Notification mail";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:2:"64";s:4:"name";s:7:"subject";s:4:"blur";s:7:"Subject";}i:2;a:3:{s:4:"type";s:8:"textarea";s:4:"size";s:5:"15,64";s:4:"name";s:4:"body";}}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:5:"label";s:4:"span";s:5:",gray";s:5:"label";s:22:"Available placeholders";}i:2;a:6:{s:4:"type";s:4:"grid";s:4:"span";s:5:",gray";s:4:"name";s:12:"replacements";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:12:"${row}[name]";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[label]";}}}s:4:"rows";i:1;s:4:"cols";i:2;}}}i:6;a:2:{s:1:"A";a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Start";s:4:"name";s:5:"start";}s:1:"B";a:3:{s:4:"type";s:6:"button";s:5:"label";s:12:"Download CSV";s:4:"name";s:12:"download_csv";}}}s:4:"rows";i:6;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1301655701',);
$templ_data[] = array('name' => 'admin.passwordreset','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:2:{s:2:"h1";s:6:",!@msg";s:2:"c5";s:4:",top";}i:1;a:3:{s:1:"A";a:3:{s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Select users";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:5:"users";s:4:"size";s:2:"15";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:9:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"6";s:5:"label";s:7:"Actions";i:1;a:3:{s:5:"label";s:21:"Set a random password";s:4:"name";s:9:"random_pw";s:4:"type";s:8:"checkbox";}i:2;a:5:{s:4:"type";s:11:"select-bool";s:5:"label";s:36:"Must change password upon next login";s:8:"onchange";s:85:"if (this.value==\'1\') document.getElementById(form::name(\'changepassword\')).value=\'1\';";s:4:"name";s:18:"mustchangepassword";s:4:"size";s:15:"Leave unchanged";}i:3;a:5:{s:4:"type";s:11:"select-bool";s:5:"label";s:19:"Can change password";s:8:"onchange";s:136:"var mustchange=document.getElementById(form::name(\'mustchangepassword\')); if (this.value==\'0\' && mustchange.value) mustchange.value=\'0\';";s:4:"name";s:14:"changepassword";s:4:"size";s:15:"Leave unchanged";}i:4;a:4:{s:4:"size";s:6:"2,,0,0";s:4:"type";s:4:"hbox";i:1;a:4:{s:5:"label";s:23:"Change password hash to";s:4:"name";s:4:"hash";s:4:"size";s:15:"Leave unchanged";s:4:"type";s:6:"select";}i:2;a:5:{s:5:"label";s:12:"Current hash";s:8:"readonly";s:4:"true";s:4:"name";s:12:"current_hash";s:4:"type";s:4:"text";s:4:"span";s:14:",leftPad5 gray";}}i:5;a:3:{s:5:"label";s:20:"Notify user by email";s:4:"name";s:6:"notify";s:4:"type";s:8:"checkbox";}i:6;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:4:{s:4:"type";s:6:"select";s:5:"label";s:12:"Mail account";s:4:"name";s:14:"mail[activate]";s:4:"size";s:15:"Leave unchanged";}i:2;a:5:{s:4:"type";s:3:"int";s:5:"label";s:10:"Quota (MB)";s:4:"name";s:11:"mail[quota]";s:4:"size";s:1:",";s:4:"help";s:20:"|empty to NOT change";}i:3;a:5:{s:5:"label";s:6:"Domain";s:4:"name";s:12:"mail[domain]";s:4:"type";s:4:"text";s:4:"help";s:43:"|change domain of email address and aliases";s:4:"size";s:36:",,/^[a-z0-9]+([._-]{1}[a-z0-9]+)+$/i";}}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:5;a:2:{s:1:"A";a:5:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"2";s:5:"label";s:17:"Notification mail";i:1;a:4:{s:4:"blur";s:7:"Subject";s:4:"size";s:2:"64";s:4:"name";s:7:"subject";s:4:"type";s:4:"text";}i:2;a:3:{s:4:"name";s:4:"body";s:4:"type";s:8:"textarea";s:4:"size";s:5:"15,64";}}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:5:"label";s:5:"label";s:22:"Available placeholders";s:4:"span";s:5:",gray";}i:2;a:5:{s:4:"type";s:4:"grid";s:4:"name";s:12:"replacements";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"name";s:12:"${row}[name]";s:4:"type";s:5:"label";}s:1:"B";a:2:{s:4:"name";s:13:"${row}[label]";s:4:"type";s:5:"label";}}}s:4:"cols";i:2;s:4:"rows";i:1;}}}i:6;a:2:{s:1:"A";a:3:{s:5:"label";s:5:"Start";s:4:"name";s:5:"start";s:4:"type";s:6:"button";}s:1:"B";a:3:{s:5:"label";s:12:"Download CSV";s:4:"name";s:12:"download_csv";s:4:"type";s:6:"button";}}}s:4:"cols";i:3;s:4:"rows";i:6;}}','size' => '','style' => '','modified' => '1365170063',);
$templ_data[] = array('name' => 'admin.remotes','template' => '','lang' => '','group' => '0','version' => '1.5.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:3:{s:2:"h2";s:9:",!@remote";s:2:"h1";s:6:",!@msg";s:2:"h3";s:2:",1";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:6:"remote";s:4:"span";s:10:"all,border";s:4:"name";s:18:"admin.remotes.edit";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"template";s:5:"align";s:5:"right";s:4:"name";s:26:"admin.remotes.header_right";}}i:4;a:1:{s:1:"A";a:3:{s:4:"type";s:9:"nextmatch";s:4:"name";s:2:"nm";s:4:"size";s:18:"admin.remotes.rows";}}}s:4:"rows";i:4;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.border { border: black solid 2px; }','modified' => '1195926693',);

View File

@ -6,11 +6,13 @@
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row disabled="!@msg">
<description id="msg" span="all" class="redItalic"/>
<description/>
<description/>
</row>
<row>
<description value="Select users"/>
@ -39,9 +41,10 @@
<checkbox label="Notify user by email" id="notify"/>
<hbox>
<menulist>
<menupopup type="select-bool" label="Activate mail account" id="mail[activate]" options="Leave unchanged"/>
<menupopup label="Mail account" id="mail[activate]" options="Leave unchanged"/>
</menulist>
<textbox type="integer" statustext="|empty to NOT change" label="Quota (MB)" id="mail[quota]"/>
<textbox statustext="|change domain of email address and aliases" label="Domain" id="mail[domain]" validator="/^[a-z0-9]+([._-]{1}[a-z0-9]+)+$/i"/>
</hbox>
</groupbox>
<description/>