From 1bf8beaa585dbfbd09a7d3fb84d08e2f1e3da2d5 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Tue, 16 May 2023 11:10:41 +0200 Subject: [PATCH] [Web] revert configurable authsource --- data/web/inc/functions.mailbox.inc.php | 6 +--- data/web/js/site/mailbox.js | 29 ----------------- .../web/templates/edit/mailbox-templates.twig | 9 ------ data/web/templates/modals/mailbox.twig | 31 +++++-------------- 4 files changed, 8 insertions(+), 67 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 45f46fd0..8cd38a6d 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1005,7 +1005,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - if (in_array($_data['authsource'], array('mailcow', 'keycloak'))){ + if (in_array($_data['authsource'], array('mailcow', 'keycloak', 'generic-oidc'))){ $authsource = $_data['authsource']; } $password = $_data['password']; @@ -1500,9 +1500,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { // check attributes - $authsources = array('mailcow', 'keycloak'); $attr = array(); - $attr["authsource"] = (isset($_data['authsource']) && in_array($_data['authsource'], $authsources)) ? $_data['authsource'] : 'mailcow'; $attr["quota"] = isset($_data['quota']) ? intval($_data['quota']) * 1048576 : 0; $attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : array(); $attr["quarantine_notification"] = (!empty($_data['quarantine_notification'])) ? $_data['quarantine_notification'] : strval($MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification']); @@ -3184,9 +3182,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $_data["template"] = (isset($_data["template"])) ? $_data["template"] : $is_now["template"]; } // check attributes - $authsources = array('mailcow', 'keycloak'); $attr = array(); - $attr["authsource"] = (isset($_data['authsource']) && in_array($_data['authsource'], $authsources)) ? $_data['authsource'] : $is_now['authsource']; $attr["quota"] = isset($_data['quota']) ? intval($_data['quota']) * 1048576 : 0; $attr['tags'] = (isset($_data['tags'])) ? $_data['tags'] : $is_now['tags']; $attr["quarantine_notification"] = (!empty($_data['quarantine_notification'])) ? $_data['quarantine_notification'] : $is_now['quarantine_notification']; diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index 6f4c50db..bc2a1bb8 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -162,17 +162,6 @@ $(document).ready(function() { } }); }); - // @selecting identity provider mbox_add_modal - $('#mbox_add_iam').on('change', function(){ - // toggle password fields - if (this.value === 'mailcow'){ - $('#mbox_add_pwds').removeClass('d-none'); - $('#mbox_add_pwds').find('.form-control').prop('required', true); - } else { - $('#mbox_add_pwds').addClass('d-none'); - $('#mbox_add_pwds').find('.form-control').prop('required', false); - } - }); // Sieve data modal $('#sieveDataModal').on('show.bs.modal', function(e) { var sieveScript = $(e.relatedTarget).data('sieve-script'); @@ -280,15 +269,6 @@ $(document).ready(function() { } function setMailboxTemplateData(template){ $("#addInputQuota").val(template.quota / 1048576); - $('#mbox_add_iam').selectpicker('val', template.authsource); - // toggle password fields - if (!template.authsource || template.authsource === 'mailcow'){ - $('#mbox_add_pwds').removeClass('d-none'); - $('#mbox_add_pwds').find('.form-control').prop('required', true); - } else { - $('#mbox_add_pwds').addClass('d-none'); - $('#mbox_add_pwds').find('.form-control').prop('required', false); - } if (template.quarantine_notification === "never"){ $('#quarantine_notification_never').prop('checked', true); @@ -1268,15 +1248,6 @@ jQuery(function($){ data: 'attributes.quota', defaultContent: '', }, - { - title: lang.iam, - data: 'attributes.authsource', - defaultContent: '', - render: function (data, type) { - data = data ? '' + data + '' : ''; - return data; - } - }, { title: lang.tls_enforce_in, data: 'attributes.tls_enforce_in', diff --git a/data/web/templates/edit/mailbox-templates.twig b/data/web/templates/edit/mailbox-templates.twig index 749cf2bb..fea99bdd 100644 --- a/data/web/templates/edit/mailbox-templates.twig +++ b/data/web/templates/edit/mailbox-templates.twig @@ -19,15 +19,6 @@ -
- -
- -
-
diff --git a/data/web/templates/modals/mailbox.twig b/data/web/templates/modals/mailbox.twig index d9945390..fbd35f73 100644 --- a/data/web/templates/modals/mailbox.twig +++ b/data/web/templates/modals/mailbox.twig @@ -11,19 +11,20 @@ + -
- -
- -
-
+
+ +
+ +
+
@@ -41,15 +42,6 @@
-
- -
- -
-
@@ -237,15 +229,6 @@
-
- -
- -
-