public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
[Web] revert configurable authsource
0c1e2ed6
data/web/inc/functions.mailbox.inc.php | 6 +-----
data/web/js/site/mailbox.js | 29 --------------------------
data/web/templates/edit/mailbox-templates.twig | 9 --------
data/web/templates/modals/mailbox.twig | 27 +++++-------------------
4 files changed, 6 insertions(+), 65 deletions(-)
Diff
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php
index f549785e..b9a98043 100644
--- a/data/web/inc/functions.mailbox.inc.php
+++ b/data/web/inc/functions.mailbox.inc.php
@@ -1019,7 +1019,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'];
}
if (empty($name)) {
@@ -1546,9 +1546,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']);
@@ -3236,9 +3234,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 06c1444d..1dc6b4f5 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);
@@ -1291,15 +1271,6 @@ jQuery(function($){
data: 'attributes.quota',
defaultContent: '',
},
- {
- title: lang.iam,
- data: 'attributes.authsource',
- defaultContent: '',
- render: function (data, type) {
- data = data ? '<span class="badge bg-primary">' + data + '<i class="ms-2 bi bi-person-circle"></i></i></span>' : '<i class="bi bi-x-lg"></i>';
- 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 c83a15dd..f606bd45 100644
--- a/data/web/templates/edit/mailbox-templates.twig
+++ b/data/web/templates/edit/mailbox-templates.twig
@@ -19,15 +19,6 @@
</div>
</div>
</div>
- <div class="row mb-2">
- <label class="control-label col-sm-2" for="authsource">{{ lang.admin.iam }}</label>
- <div class="col-sm-10">
- <select class="full-width-select" data-live-search="true" id="mbox_template_iam" name="authsource" required>
- <option {% if template.attributes.authsource == 'mailcow' %}selected{% endif %}>mailcow</option>
- <option {% if template.attributes.authsource == 'keycloak' %}selected{% endif %}>keycloak</option>
- </select>
- </div>
- </div>
<div class="row mb-2">
<label class="control-label col-sm-2">{{ lang.add.tags }}</label>
<div class="col-sm-10">
diff --git a/data/web/templates/modals/mailbox.twig b/data/web/templates/modals/mailbox.twig
index e0b4f02b..27f70952 100644
--- a/data/web/templates/modals/mailbox.twig
+++ b/data/web/templates/modals/mailbox.twig
@@ -11,17 +11,18 @@
<input type="hidden" value="0" name="force_pw_update">
<input type="hidden" value="0" name="sogo_access">
<input type="hidden" value="0" name="protocol_access">
+ <input type="hidden" value="mailcow" name="authsource">
<div class="row mb-2">
- <label class="control-label col-sm-2 text-sm-end text-sm-end" for="name">{{ lang.add.full_name }}</label>
+ <label class="control-label col-sm-2 text-sm-end text-sm-end" for="local_part">{{ lang.add.mailbox_username }}</label>
<div class="col-sm-10">
- <input type="text" class="form-control" name="name">
+ <input type="text" pattern="[A-Za-z0-9\.!#$%&'*+/=?^_`{|}~-]+" autocorrect="off" autocapitalize="none" class="form-control" name="local_part" required>
</div>
</div>
<div class="row mb-2">
- <label class="control-label col-sm-2 text-sm-end text-sm-end" for="local_part">{{ lang.add.mailbox_username }}</label>
+ <label class="control-label col-sm-2 text-sm-end text-sm-end" for="name">{{ lang.add.full_name }}</label>
<div class="col-sm-10">
- <input type="text" pattern="[A-Za-z0-9\.!#$%&'*+/=?^_`{|}~-]+" autocorrect="off" autocapitalize="none" class="form-control" name="local_part" required>
+ <input type="text" class="form-control" name="name">
</div>
</div>
<div class="row mb-2">
@@ -41,15 +42,6 @@
</select>
</div>
</div>
- <div class="row mb-2">
- <label class="control-label col-sm-2 text-sm-end text-sm-end" for="authsource">{{ lang.admin.iam }}</label>
- <div class="col-sm-10">
- <select class="full-width-select" data-live-search="true" id="mbox_add_iam" name="authsource" required>
- <option selected>mailcow</option>
- <option>keycloak</option>
- </select>
- </div>
- </div>
<div id="mbox_add_pwds">
<div class="row mb-2">
<label class="control-label col-sm-2 text-sm-end text-sm-end" for="password">{{ lang.add.password }} (<a href="#" class="generate_password">{{ lang.add.generate }}</a>)</label>
@@ -236,15 +228,6 @@
</div>
</div>
</div>
- <div class="row mb-2">
- <label class="control-label col-sm-2 text-sm-end text-sm-end" for="authsource">{{ lang.admin.iam }}</label>
- <div class="col-sm-10">
- <select class="full-width-select" data-live-search="true" id="mbox_template_iam" name="authsource">
- <option selected>mailcow</option>
- <option>keycloak</option>
- </select>
- </div>
- </div>
<div class="row mb-2">
<label class="control-label col-sm-2 text-sm-end text-sm-end">{{ lang.add.tags }}</label>
<div class="col-sm-10">