1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-23 02:04:46 +02:00

[Web] revert configurable authsource

This commit is contained in:
FreddleSpl0it 2023-05-16 11:10:41 +02:00 committed by DerLinkman
parent 90476ae057
commit 0c1e2ed6f2
No known key found for this signature in database
GPG Key ID: F109FD97469550A2
4 changed files with 8 additions and 67 deletions

View File

@ -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'];

View File

@ -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',

View File

@ -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">

View File

@ -11,19 +11,20 @@
<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>
<div class="col-sm-10">
<input type="text" class="form-control" name="name">
</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>
<div class="col-sm-10">
<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="name">{{ lang.add.full_name }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name">
</div>
</div>
<div class="row mb-2">
<label class="control-label col-sm-2 text-sm-end text-sm-end" for="domain">{{ lang.add.domain }}</label>
<div class="col-sm-10">
@ -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">