[Web] Allow to set rate limit in add_domain modal
[Web] Cleanup rate limits when deleting objectsmaster
parent
d64a89473e
commit
d28fd4070b
|
@ -415,6 +415,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
if (!empty(intval($_data['rl_value']))) {
|
||||
ratelimit('edit', 'domain', array('rl_value' => $rl_value, 'rl_frame' => $_data['rl_frame'], 'object' => $domain));
|
||||
}
|
||||
if (!empty($restart_sogo)) {
|
||||
$restart_reponse = json_decode(docker('post', 'sogo-mailcow', 'restart'), true);
|
||||
if ($restart_reponse['type'] == "success") {
|
||||
|
@ -3094,6 +3097,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|||
));
|
||||
try {
|
||||
$redis->hDel('DOMAIN_MAP', $domain);
|
||||
$redis->hDel('RL_VALUE', $domain);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'][] = array(
|
||||
|
@ -3182,6 +3186,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|||
));
|
||||
try {
|
||||
$redis->hDel('DOMAIN_MAP', $alias_domain);
|
||||
$redis->hDel('RL_VALUE', $domain);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'][] = array(
|
||||
|
@ -3301,6 +3306,17 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
|||
':address' => $gotos['address']
|
||||
));
|
||||
}
|
||||
try {
|
||||
$redis->hDel('RL_VALUE', $username);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'danger',
|
||||
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||
'msg' => array('redis_error', $e)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
$_SESSION['return'][] = array(
|
||||
'type' => 'success',
|
||||
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
|
||||
|
|
|
@ -62,7 +62,7 @@ function ratelimit($_action, $_scope, $_data = null) {
|
|||
$_SESSION['return'][] = array(
|
||||
'type' => 'success',
|
||||
'log' => array(__FUNCTION__, $_action, $_scope, $_data_log),
|
||||
'msg' => array('object_modified', $object)
|
||||
'msg' => array('rl_saved', $object)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
@ -123,7 +123,7 @@ function ratelimit($_action, $_scope, $_data = null) {
|
|||
$_SESSION['return'][] = array(
|
||||
'type' => 'success',
|
||||
'log' => array(__FUNCTION__, $_action, $_scope, $_data_log),
|
||||
'msg' => array('object_modified', $object)
|
||||
'msg' => array('rl_saved', $object)
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -42,6 +42,7 @@ $lang['danger']['filter_type'] = "Falscher Filtertyp";
|
|||
$lang['danger']['domain_cannot_match_hostname'] = "Domain darf nicht dem Hostnamen entsprechen";
|
||||
$lang['warning']['domain_added_sogo_failed'] = "Domain wurde hinzugefügt; SOGo konnte nicht neugestartet werden";
|
||||
$lang['danger']['rl_timeframe'] = "Ratelimit Zeitraum ist inkorrekt";
|
||||
$lang['success']['rl_saved'] = "Ratelimit für Objekt %s wurde gesetzt";
|
||||
$lang['success']['deleted_syncjobs'] = "Syncjobs gelöscht: %s";
|
||||
$lang['success']['deleted_syncjob'] = "Syncjobs ID %s gelöscht";
|
||||
$lang['success']['delete_filters'] = "Filter gelöscht: %s";
|
||||
|
|
|
@ -41,7 +41,8 @@ $lang['danger']['value_missing'] = "Please provide all values";
|
|||
$lang['danger']['filter_type'] = "Wrong filter type";
|
||||
$lang['danger']['domain_cannot_match_hostname'] = "Domain cannot match hostname";
|
||||
$lang['warning']['domain_added_sogo_failed'] = "Added domain but failed to restart SOGo, please check your server logs.";
|
||||
$lang['danger']['rl_timeframe'] = "Ratelimit time frame is incorrect";
|
||||
$lang['danger']['rl_timeframe'] = "Rate limit time frame is incorrect";
|
||||
$lang['success']['rl_saved'] = "Rate limit for object %s saved";
|
||||
$lang['success']['deleted_syncjobs'] = "Deleted syncjobs: %s";
|
||||
$lang['success']['deleted_syncjob'] = "Deleted syncjob ID %s";
|
||||
$lang['success']['delete_filters'] = "Deleted filters: %s";
|
||||
|
@ -489,7 +490,7 @@ $lang['admin']['rsetting_desc'] = 'Short description';
|
|||
$lang['admin']['rsetting_content'] = 'Rule content';
|
||||
$lang['admin']['rsetting_none'] = 'No rule available';
|
||||
$lang['admin']['rsetting_no_selection'] = 'Please select a rule';
|
||||
$lang['admin']['rsettings_preset_1'] = 'Disable all but DKIM and ratelimit for authenticated users';
|
||||
$lang['admin']['rsettings_preset_1'] = 'Disable all but DKIM and rate limit for authenticated users';
|
||||
$lang['admin']['rsettings_preset_2'] = 'Postmasters want spam';
|
||||
$lang['admin']['rsettings_insert_preset'] = 'Insert example preset "%s"';
|
||||
$lang['admin']['rsetting_add_rule'] = 'Add rule';
|
||||
|
|
|
@ -123,6 +123,28 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
|||
<input type="number" class="form-control" name="quota" id="quota" value="10240" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" value="1" name="active" checked> <?=$lang['add']['active'];?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="quota">Ratelimit</label>
|
||||
<div class="col-sm-7">
|
||||
<input name="rl_value" id="rl_value" type="number" value="<?=(!empty($rl['value'])) ? $rl['value'] : null;?>" class="form-control" placeholder="disabled">
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<select name="rl_frame" id="rl_frame" class="form-control">
|
||||
<option value="s" <?=(isset($rl['frame']) && $rl['frame'] == 's') ? 'selected' : null;?>>msgs / second</option>
|
||||
<option value="m" <?=(isset($rl['frame']) && $rl['frame'] == 'm') ? 'selected' : null;?>>msgs / minute</option>
|
||||
<option value="h" <?=(isset($rl['frame']) && $rl['frame'] == 'h') ? 'selected' : null;?>>msgs / hour</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2"><?=$lang['add']['backup_mx_options'];?></label>
|
||||
<div class="col-sm-10">
|
||||
|
@ -134,13 +156,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" value="1" name="active" checked> <?=$lang['add']['active'];?></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button class="btn btn-default" id="add_item" data-id="add_domain" data-api-url='add/domain' data-api-attr='{}' href="#"><?=$lang['add']['add_domain_only'];?></button>
|
||||
|
|
Loading…
Reference in New Issue