diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-08-24 23:47:05 +0000 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2021-08-27 05:15:20 +0000 |
commit | f6119b7f23d821c2eab2b63a1c6265dcaa586fdc (patch) | |
tree | 610eacf7d60e65bf1c766a177bc9d71dd747629c /apps/settings/src/utils | |
parent | 3f6586ba034731ed2e4ec4cd06744634c857ef6b (diff) | |
download | nextcloud-server-f6119b7f23d821c2eab2b63a1c6265dcaa586fdc.tar.gz nextcloud-server-f6119b7f23d821c2eab2b63a1c6265dcaa586fdc.zip |
Refine input validation
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/settings/src/utils')
-rw-r--r-- | apps/settings/src/utils/validate.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/settings/src/utils/validate.js b/apps/settings/src/utils/validate.js index abea6250f3f..e2c7d82da2f 100644 --- a/apps/settings/src/utils/validate.js +++ b/apps/settings/src/utils/validate.js @@ -20,6 +20,12 @@ * */ +/* + * Frontend validators, less strict than backend validators + * + * TODO add nice validation errors for Profile page settings modal + */ + import { VALIDATE_EMAIL_REGEX } from '../constants/AccountPropertyConstants' /** @@ -49,3 +55,14 @@ export function validateEmail(input) { && input.length <= 320 && encodeURIComponent(input).replace(/%../g, 'x').length <= 320 } + +/** + * Validate the language input + * + * @param {string} input the input + * @returns {boolean} + */ +export function validateLanguage(input) { + return input.code !== '' + && input.name +} |