From 5e2b8ab8d7d80f91a6d1e1951041defcd431b841 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 13 Jun 2018 10:42:40 +0000 Subject: Resolve "Bug: When creating an account with invalid characters the error is "Username already taken" not "Invalid characters used"" --- app/assets/javascripts/pages/sessions/new/username_validator.js | 9 ++++----- changelogs/unreleased/45575-invalid-characters-signup.yml | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/45575-invalid-characters-signup.yml diff --git a/app/assets/javascripts/pages/sessions/new/username_validator.js b/app/assets/javascripts/pages/sessions/new/username_validator.js index 825de01b5a2..87213c94eda 100644 --- a/app/assets/javascripts/pages/sessions/new/username_validator.js +++ b/app/assets/javascripts/pages/sessions/new/username_validator.js @@ -62,13 +62,13 @@ export default class UsernameValidator { return this.setPendingState(); } - if (!this.state.available) { - return this.setUnavailableState(); - } - if (!this.state.valid) { return this.setInvalidState(); } + + if (!this.state.available) { + return this.setUnavailableState(); + } } interceptInvalid(event) { @@ -89,7 +89,6 @@ export default class UsernameValidator { setAvailabilityState(usernameTaken) { if (usernameTaken) { - this.state.valid = false; this.state.available = false; } else { this.state.available = true; diff --git a/changelogs/unreleased/45575-invalid-characters-signup.yml b/changelogs/unreleased/45575-invalid-characters-signup.yml new file mode 100644 index 00000000000..679bd13e59b --- /dev/null +++ b/changelogs/unreleased/45575-invalid-characters-signup.yml @@ -0,0 +1,5 @@ +--- +title: 'Fix username validation order on signup, resolves #45575' +merge_request: 19610 +author: Jan Beckmann +type: fixed -- cgit v1.2.1