mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-29 12:04:02 +00:00
[address book] added check for invalid input when set group quota
This commit is contained in:
parent
c0c449db48
commit
266b6330b1
@ -234,6 +234,10 @@ class AdminGroup(APIView):
|
|||||||
error_msg = 'quota invalid.'
|
error_msg = 'quota invalid.'
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
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:
|
try:
|
||||||
seafile_api.set_group_quota(group_id, group_quota)
|
seafile_api.set_group_quota(group_id, group_quota)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -68,12 +68,18 @@ define([
|
|||||||
var $error = $('.error', $form);
|
var $error = $('.error', $form);
|
||||||
var $submitBtn = $('[type="submit"]', $form);
|
var $submitBtn = $('[type="submit"]', $form);
|
||||||
var quota = $.trim($('[name="quota"]', $form).val());
|
var quota = $.trim($('[name="quota"]', $form).val());
|
||||||
|
var quota_int = parseInt(quota);
|
||||||
|
|
||||||
if (!quota) {
|
if (!quota) {
|
||||||
$error.html(gettext("It is required.")).show();
|
$error.html(gettext("It is required.")).show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(quota_int == quota &&
|
||||||
|
(quota_int > 0 || quota_int == -2))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Common.disableButton($submitBtn);
|
Common.disableButton($submitBtn);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Common.getUrl({
|
url: Common.getUrl({
|
||||||
|
Loading…
Reference in New Issue
Block a user