summaryrefslogtreecommitdiffstats
path: root/apps/files_external/js
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2016-01-26 17:25:59 +0000
committerRobin McCorkell <rmccorkell@owncloud.com>2016-01-26 17:42:35 +0000
commit405e2d9b50eb40e28b0cd1f805042aae9d6512e8 (patch)
treeb309ebe5b03f8bf6da819979ab5dcf014bc60d1d /apps/files_external/js
parentecf2d178b1c3db3000f4d9c9d65f08ec3890488e (diff)
downloadnextcloud-server-405e2d9b50eb40e28b0cd1f805042aae9d6512e8.tar.gz
nextcloud-server-405e2d9b50eb40e28b0cd1f805042aae9d6512e8.zip
Fix validation of inputs that aren't text
Diffstat (limited to 'apps/files_external/js')
-rw-r--r--apps/files_external/js/settings.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 2f879e1c850..756804238d0 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -59,10 +59,24 @@ function highlightBorder($element, highlight) {
return highlight;
}
+function isInputValid($input) {
+ var optional = $input.hasClass('optional');
+ switch ($input.attr('type')) {
+ case 'text':
+ case 'password':
+ if ($input.val() === '' && !optional) {
+ return false;
+ }
+ break;
+ }
+ return true;
+}
+
function highlightInput($input) {
- if ($input.attr('type') === 'text' || $input.attr('type') === 'password') {
- return highlightBorder($input,
- ($input.val() === '' && !$input.hasClass('optional')));
+ switch ($input.attr('type')) {
+ case 'text':
+ case 'password':
+ return highlightBorder($input, !isInputValid($input));
}
}
@@ -952,7 +966,7 @@ MountConfigListView.prototype = _.extend({
if ($input.attr('type') === 'button') {
return;
}
- if ($input.val() === '' && !$input.hasClass('optional')) {
+ if (!isInputValid($input)) {
missingOptions.push(parameter);
return;
}