diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-07-21 19:42:53 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-08-26 18:50:28 +0000 |
commit | e2efbab13f8c0663b95d53fa8c9c095f02de7141 (patch) | |
tree | 1d2990dba4e8ff183b5852ebb7047db3efade9d6 /apps/settings/src/utils | |
parent | 47584eee601594a066099b701e0ea61a5c8fec2a (diff) | |
download | nextcloud-server-e2efbab13f8c0663b95d53fa8c9c095f02de7141.tar.gz nextcloud-server-e2efbab13f8c0663b95d53fa8c9c095f02de7141.zip |
Remake website property saving with Vue
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps/settings/src/utils')
-rw-r--r-- | apps/settings/src/utils/validate.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/settings/src/utils/validate.js b/apps/settings/src/utils/validate.js index 83af1d94fbb..7d0cf1d9e33 100644 --- a/apps/settings/src/utils/validate.js +++ b/apps/settings/src/utils/validate.js @@ -26,7 +26,7 @@ * TODO add nice validation errors for Profile page settings modal */ -import { VALIDATE_EMAIL_REGEX } from '../constants/AccountPropertyConstants' +import { VALIDATE_EMAIL_REGEX } from '../constants/AccountPropertyConstants.js' /** * Validate the email input @@ -47,6 +47,22 @@ export function validateEmail(input) { } /** + * Validate the URL input + * + * @param {string} input the input + * @return {boolean} + */ +export function validateUrl(input) { + try { + // eslint-disable-next-line no-new + new URL(input) + return true + } catch (e) { + return false + } +} + +/** * Validate the language input * * @param {object} input the input |