mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-05 16:08:21 +00:00
[Web] Pending account setup adjustments
This commit is contained in:
2 files changed
+27
No files matched your search
@@ -74,6 +74,15 @@ function admin($_action, $_data = null) {
|
|||||||
$usernames = $_data['username'];
|
$usernames = $_data['username'];
|
||||||
}
|
}
|
||||||
foreach ($usernames as $username) {
|
foreach ($usernames as $username) {
|
||||||
|
// A pending password update only allows changing the own password
|
||||||
|
if (!empty($_SESSION['pending_pw_update']) && $username != $_SESSION['mailcow_cc_username']) {
|
||||||
|
$_SESSION['return'][] = array(
|
||||||
|
'type' => 'danger',
|
||||||
|
'log' => array(__FUNCTION__, $_action, $_data_log),
|
||||||
|
'msg' => 'access_denied'
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$is_now = admin('details', $username);
|
$is_now = admin('details', $username);
|
||||||
if (!empty($is_now)) {
|
if (!empty($is_now)) {
|
||||||
$active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active'];
|
$active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active'];
|
||||||
|
|||||||
@@ -105,6 +105,24 @@ if (isset($_GET['query'])) {
|
|||||||
'msg' => 'Cannot find attributes in post data'
|
'msg' => 'Cannot find attributes in post data'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// A login with pending 2FA setup or password update may only use the calls of these steps
|
||||||
|
if (!empty($_SESSION['pending_tfa_setup']) || !empty($_SESSION['pending_pw_update'])) {
|
||||||
|
if (!empty($_SESSION['pending_tfa_setup'])) {
|
||||||
|
$pending_allowed = array('get/passwordpolicy', 'get/webauthn-tfa-registration', 'add/webauthn-tfa-registration');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pending_allowed = array('get/passwordpolicy', 'edit/self', 'edit/admin');
|
||||||
|
}
|
||||||
|
if (!in_array($action . '/' . $category, $pending_allowed)) {
|
||||||
|
http_response_code(403);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'API access denied until the pending account setup is finished'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case "add":
|
case "add":
|
||||||
if ($_SESSION['mailcow_cc_api_access'] == 'ro' || isset($_SESSION['pending_mailcow_cc_username']) || !isset($_SESSION["mailcow_cc_username"])) {
|
if ($_SESSION['mailcow_cc_api_access'] == 'ro' || isset($_SESSION['pending_mailcow_cc_username']) || !isset($_SESSION["mailcow_cc_username"])) {
|
||||||
|
|||||||
Reference in new issue
Block a user