From 5e9b2e7ad2fa26605946f3de6662fb8d96a42d79 Mon Sep 17 00:00:00 2001 From: Axolotle Date: Sun, 26 Jul 2020 19:22:38 +0200 Subject: [PATCH] testing some form validation --- app/src/locales/en.json | 5 ++ app/src/scss/main.scss | 6 ++ app/src/views/Login.vue | 5 -- app/src/views/user/UserCreate.vue | 105 +++++++++++++++++++++++------- 4 files changed, 94 insertions(+), 27 deletions(-) diff --git a/app/src/locales/en.json b/app/src/locales/en.json index 136a57c5..f8e81f4f 100644 --- a/app/src/locales/en.json +++ b/app/src/locales/en.json @@ -119,6 +119,11 @@ "experimental_warning": "Warning: this feature is experimental and not consider stable, you shouldn't be using it except if you know what you are doing.", "firewall": "Firewall", "footer_version": "Powered by {ynh} {version} ({repo}).", + "form_errors": { + "username_syntax": "Invalid username: Must be lower-case alphanumeric and underscore characters only", + "username_exists": "The user '{user}' already exists", + "email_syntax": "Invalid email: Must be alphanumeric, underscore and dash characters only (e.g. someone@example.com, s0me-1@example.com)" + }, "form_input_example": "Example: %s", "from_to": "from %s to %s", "good_practices_about_admin_password": "You are now about to define a new admin password. The password should be at least 8 characters - though it is good practice to use longer password (i.e. a passphrase) and/or to use various kind of characters (uppercase, lowercase, digits and special characters).", diff --git a/app/src/scss/main.scss b/app/src/scss/main.scss index ef067c6d..84ea866b 100644 --- a/app/src/scss/main.scss +++ b/app/src/scss/main.scss @@ -30,6 +30,12 @@ body { color: #333; } +.input-group.is-invalid { + ~ .invalid-feedback { + display: block; + } +} + // Fork-awesome overrides .fa-fw { diff --git a/app/src/views/Login.vue b/app/src/views/Login.vue index 493c2939..f27cebe2 100644 --- a/app/src/views/Login.vue +++ b/app/src/views/Login.vue @@ -58,9 +58,4 @@ export default { diff --git a/app/src/views/user/UserCreate.vue b/app/src/views/user/UserCreate.vue index 98967c1f..fa6516cb 100644 --- a/app/src/views/user/UserCreate.vue +++ b/app/src/views/user/UserCreate.vue @@ -8,9 +8,15 @@ label-cols-sm="5" label-cols-lg="4" label-cols-xl="3" :label="$t('user_username')" label-for="input-username" label-class="test" > - + + {{ this.error.username }} + @@ -51,12 +57,14 @@ @@ -67,6 +75,10 @@ + + + {{ this.error.email }} + - + {{ $t('passwords_too_short') }} @@ -103,13 +116,18 @@ > - + {{ $t('passwords_dont_match') }} + + + {{ this.server.error }} +