1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 15:57:31 +00:00

[address book] added check for invalid input when set group quota

This commit is contained in:
llj 2018-05-09 18:01:02 +08:00
parent c0c449db48
commit 266b6330b1
2 changed files with 10 additions and 0 deletions

View File

@ -234,6 +234,10 @@ class AdminGroup(APIView):
error_msg = 'quota invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
if not (group_quota > 0 or group_quota == -2):
error_msg = 'quota invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
try:
seafile_api.set_group_quota(group_id, group_quota)
except Exception as e:

View File

@ -68,12 +68,18 @@ define([
var $error = $('.error', $form);
var $submitBtn = $('[type="submit"]', $form);
var quota = $.trim($('[name="quota"]', $form).val());
var quota_int = parseInt(quota);
if (!quota) {
$error.html(gettext("It is required.")).show();
return false;
}
if (!(quota_int == quota &&
(quota_int > 0 || quota_int == -2))) {
return false;
}
Common.disableButton($submitBtn);
$.ajax({
url: Common.getUrl({