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
Fix force_tfa not available in mailbox template #7216
0fafda69
data/web/api/openapi.yaml | 14 +++++++++++++-
data/web/inc/functions.mailbox.inc.php | 1 +
data/web/js/site/mailbox.js | 11 +++++++++++
data/web/lang/lang.en-gb.json | 1 +
data/web/templates/edit/mailbox-templates.twig | 9 +++++++++
5 files changed, 35 insertions(+), 1 deletion(-)
Diff
diff --git a/data/web/api/openapi.yaml b/data/web/api/openapi.yaml
index cf54f6ad..77c58b60 100644
--- a/data/web/api/openapi.yaml
+++ b/data/web/api/openapi.yaml
@@ -1072,6 +1072,7 @@ paths:
password2: "*"
quota: "3072"
force_pw_update: "1"
+ force_tfa: "1"
tls_enforce_in: "1"
tls_enforce_out: "1"
tags: ["tag1", "tag2"]
@@ -1118,6 +1119,7 @@ paths:
password2: atedismonsin
quota: "3072"
force_pw_update: "1"
+ force_tfa: "1"
tls_enforce_in: "1"
tls_enforce_out: "1"
tags: ["tag1", "tag2"]
@@ -1151,6 +1153,9 @@ paths:
force_pw_update:
description: forces the user to update its password on first login
type: boolean
+ force_tfa:
+ description: force 2FA enrollment at login
+ type: boolean
tls_enforce_in:
description: force inbound email tls encryption
type: boolean
@@ -2510,7 +2515,7 @@ paths:
description: >-
Using this endpoint you can perform actions on quarantine items. It is possible to release
emails from quarantine into to the inbox, or learn them as ham to improve Rspamd filtering.
- You must provide the quarantine item IDs. You can get the IDs using the GET method.
+ You must provide the quarantine item IDs. You can get the IDs using the GET method.
operationId: Edit mails in Quarantine
requestBody:
content:
@@ -3414,6 +3419,7 @@ paths:
- mailbox
- active: "1"
force_pw_update: "0"
+ force_tfa: "0"
name: Full name
password: "*"
password2: "*"
@@ -3464,6 +3470,7 @@ paths:
attr:
active: "1"
force_pw_update: "0"
+ force_tfa: "0"
name: Full name
authsource: mailcow
password: ""
@@ -3487,6 +3494,9 @@ paths:
force_pw_update:
description: force user to change password on next login
type: boolean
+ force_tfa:
+ description: force 2FA enrollment at login
+ type: boolean
name:
description: Full name of the mailbox user
type: string
@@ -4881,6 +4891,7 @@ paths:
- active: "1"
attributes:
force_pw_update: "0"
+ force_tfa: "0"
mailbox_format: "maildir:"
quarantine_notification: never
sogo_access: "1"
@@ -5805,6 +5816,7 @@ paths:
- active: "1"
attributes:
force_pw_update: "0"
+ force_tfa: "0"
mailbox_format: "maildir:"
quarantine_notification: never
sogo_access: "1"
diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php
index adb330ea..b6d683e1 100644
--- a/data/web/inc/functions.mailbox.inc.php
+++ b/data/web/inc/functions.mailbox.inc.php
@@ -3828,6 +3828,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$attr["rl_frame"] = (!empty($_data['rl_frame'])) ? $_data['rl_frame'] : $is_now['rl_frame'];
$attr["rl_value"] = (!empty($_data['rl_value'])) ? $_data['rl_value'] : $is_now['rl_value'];
$attr["force_pw_update"] = isset($_data['force_pw_update']) ? intval($_data['force_pw_update']) : $is_now['force_pw_update'];
+ $attr["force_tfa"] = isset($_data['force_tfa']) ? intval($_data['force_tfa']) : $is_now['force_tfa'];
$attr["sogo_access"] = isset($_data['sogo_access']) ? intval($_data['sogo_access']) : $is_now['sogo_access'];
$attr["active"] = isset($_data['active']) ? intval($_data['active']) : $is_now['active'];
$attr["tls_enforce_in"] = isset($_data['tls_enforce_in']) ? intval($_data['tls_enforce_in']) : $is_now['tls_enforce_in'];
diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js
index e8edb994..0a019279 100644
--- a/data/web/js/site/mailbox.js
+++ b/data/web/js/site/mailbox.js
@@ -424,6 +424,11 @@ $(document).ready(function() {
} else {
$('#force_pw_update').prop('checked', false);
}
+ if (template.force_tfa == 1){
+ $('#force_tfa').prop('checked', true);
+ } else {
+ $('#force_tfa').prop('checked', false);
+ }
if (template.sogo_access == 1){
$('#sogo_access').prop('checked', true);
} else {
@@ -1242,6 +1247,7 @@ jQuery(function($){
item.attributes.eas_access = '<i class="text-' + (item.attributes.eas_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.eas_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.eas_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.dav_access = '<i class="text-' + (item.attributes.dav_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.dav_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.dav_access == 1 ? '1' : '0') + '</span></i>';
item.attributes.sogo_access = '<i class="text-' + (item.attributes.sogo_access == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.sogo_access == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.sogo_access == 1 ? '1' : '0') + '</span></i>';
+ item.attributes.force_tfa = '<i class="text-' + (item.attributes.force_tfa == 1 ? 'success' : 'danger') + ' bi bi-' + (item.attributes.force_tfa == 1 ? 'check-lg' : 'x-lg') + '"><span class="sorting-value">' + (item.attributes.force_tfa == 1 ? '1' : '0') + '</span></i>';
if (item.attributes.quarantine_notification === 'never') {
item.attributes.quarantine_notification = lang.never;
} else if (item.attributes.quarantine_notification === 'hourly') {
@@ -1385,6 +1391,11 @@ jQuery(function($){
return 1==data?'<i class="bi bi-check-lg"></i>':'<i class="bi bi-x-lg"></i>';
}
},
+ {
+ title: lang.force_tfa,
+ data: 'attributes.force_tfa',
+ defaultContent: ''
+ },
{
title: lang_edit.ratelimit,
data: 'attributes.ratelimit',
diff --git a/data/web/lang/lang.en-gb.json b/data/web/lang/lang.en-gb.json
index e786bcbe..d2412fbf 100644
--- a/data/web/lang/lang.en-gb.json
+++ b/data/web/lang/lang.en-gb.json
@@ -929,6 +929,7 @@
"filters": "Filters",
"fname": "Full name",
"force_pw_update": "Force password update at next login",
+ "force_tfa": "TFA",
"gal": "Global Address List",
"goto_ham": "Learn as <b>ham</b>",
"goto_spam": "Learn as <b>spam</b>",
diff --git a/data/web/templates/edit/mailbox-templates.twig b/data/web/templates/edit/mailbox-templates.twig
index ddc13958..8384fa05 100644
--- a/data/web/templates/edit/mailbox-templates.twig
+++ b/data/web/templates/edit/mailbox-templates.twig
@@ -8,6 +8,7 @@
<input type="hidden" value="default" name="sender_acl">
<input type="hidden" value="0" name="force_pw_update">
+ <input type="hidden" value="0" name="force_tfa">
<input type="hidden" value="0" name="sogo_access">
<input type="hidden" value="0" name="protocol_access">
@@ -165,6 +166,14 @@
</div>
</div>
</div>
+ <div class="row">
+ <div class="offset-sm-2 col-sm-10">
+ <div class="form-check">
+ <label><input type="checkbox" class="form-check-input" value="1" name="force_tfa" id="force_tfa"{% if template.attributes.force_tfa == '1' %} checked{% endif %}> {{ lang.tfa.force_tfa }}</label>
+ <small class="text-muted">{{ lang.tfa.force_tfa_info }}</small>
+ </div>
+ </div>
+ </div>
{% if not skip_sogo %}
<div class="row">
<div class="offset-sm-2 col-sm-10">