diff options
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 +} |