Prevent negative or non-number values in quota input

This commit is contained in:
Vincent Petry 2016-06-24 09:20:13 +02:00
parent 9092d7f5ea
commit 0501d8daac
1 changed files with 6 additions and 0 deletions

View File

@ -582,6 +582,12 @@ var UserList = {
if (quota === 'other') {
return;
}
if (isNaN(parseInt(quota, 10)) || parseInt(quota, 10) < 0) {
// the select component has added the bogus value, delete it again
$select.find('option[selected]').remove();
OC.Notification.showTemporary(t('core', 'Invalid quota value "{val}"', {val: quota}));
return;
}
UserList._updateQuota(uid, quota, function(returnedQuota){
if (quota !== returnedQuota) {
$select.find(':selected').text(returnedQuota);