diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index baf635dda..6c24c13f5 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -3271,6 +3271,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $pdo->beginTransaction(); $pdo->exec('SET FOREIGN_KEY_CHECKS = 0'); + // Update username in mailbox table $pdo->prepare('UPDATE mailbox SET username = :new_username, local_part = :new_local_part WHERE username = :old_username') ->execute([ ':new_username' => $new_username, @@ -3278,6 +3279,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':old_username' => $old_username ]); + $pdo->prepare("UPDATE alias SET address = :new_username, goto = :new_username2 WHERE address = :old_username") + ->execute([ + ':new_username' => $new_username, + ':new_username2' => $new_username, + ':old_username' => $old_username + ]); + // Update the username in all related tables $tables = [ 'tags_mailbox' => 'username', @@ -3287,9 +3295,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'da_acl' => 'username', 'quota2' => 'username', 'quota2replica' => 'username', - 'pushover' => 'username' + 'pushover' => 'username', + 'alias' => 'goto' ]; - foreach ($tables as $table => $column) { $pdo->prepare("UPDATE $table SET $column = :new_username WHERE $column = :old_username") ->execute([ @@ -3298,6 +3306,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ]); } + // Update c_uid, c_name and mail in _sogo_static_view table $pdo->prepare("UPDATE _sogo_static_view SET c_uid = :new_username, c_name = :new_username2, mail = :new_username3 WHERE c_uid = :old_username") ->execute([ ':new_username' => $new_username, @@ -3306,14 +3315,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':old_username' => $old_username ]); - $pdo->prepare("UPDATE alias SET address = :new_username, goto = :new_username2 WHERE address = :old_username") - ->execute([ - ':new_username' => $new_username, - ':new_username2' => $new_username, - ':old_username' => $old_username - ]); - - // Re-enable foreign key checks $pdo->exec('SET FOREIGN_KEY_CHECKS = 1'); $pdo->commit(); @@ -3325,6 +3326,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), 'msg' => $e->getMessage() ); + return false; } // move maildir diff --git a/data/web/lang/lang.de-de.json b/data/web/lang/lang.de-de.json index 79a6dc383..d22187c6a 100644 --- a/data/web/lang/lang.de-de.json +++ b/data/web/lang/lang.de-de.json @@ -645,6 +645,7 @@ "mailbox_rename_agree": "Ich habe ein Backup erstellt.", "mailbox_rename_warning": "WICHTIG! Vor dem Umbenennen der Mailbox ein Backup erstellen.", "mailbox_rename_alias": "Alias automatisch erstellen", + "mailbox_rename_title": "Neuer Lokaler Mailbox Name", "max_aliases": "Max. Aliasse", "max_mailboxes": "Max. Mailboxanzahl", "max_quota": "Max. Größe per Mailbox (MiB)", diff --git a/data/web/lang/lang.en-gb.json b/data/web/lang/lang.en-gb.json index 7833d7e43..6e898099b 100644 --- a/data/web/lang/lang.en-gb.json +++ b/data/web/lang/lang.en-gb.json @@ -645,6 +645,7 @@ "mailbox_rename_agree": "I have created a backup.", "mailbox_rename_warning": "IMPORTANT! Create a backup before renaming the mailbox.", "mailbox_rename_alias": "Create alias automatically", + "mailbox_rename_title": "New local mailbox name", "max_aliases": "Max. aliases", "max_mailboxes": "Max. possible mailboxes", "max_quota": "Max. quota per mailbox (MiB)", diff --git a/data/web/templates/edit/mailbox.twig b/data/web/templates/edit/mailbox.twig index b21ff2eec..04be194c1 100644 --- a/data/web/templates/edit/mailbox.twig +++ b/data/web/templates/edit/mailbox.twig @@ -504,7 +504,10 @@
-
+
+ {{ lang.edit.mailbox_rename_title }} +
+
@{{ result.domain }} @@ -512,12 +515,12 @@
-
+
-
+