[openstreetmap/openstreetmap-website] Add some javascript to check dynamically if the username is already taken (PR #4402)
Anton Khorev
notifications at github.com
Wed Dec 13 13:52:42 UTC 2023
@AntonKhorev commented on this pull request.
> + $("#user_display_name").toggleClass("is-valid", isValid === true)
+ $("#user_display_name").toggleClass("is-invalid", isValid === false)
+ }
+
+ function checkDisplayName(){
+ const displayName = $("#user_display_name").val()
+ if(displayName === ""){
+ indicateInvalidDisplayName(false)
+ return;
+ }
+ if(displayName.match(/[\/;.,?%#]/)!== null) {
+ // We detected an invalid character
+ indicateInvalidDisplayName(false)
+ return
+ }
+ indicateInvalidDisplayName(!isTaken[displayName])
`!undefined` is going to be true, the username will be indicated as valid until the fetch completes
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4402#pullrequestreview-1779689817
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4402/review/1779689817 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231213/b8af521f/attachment.htm>
More information about the rails-dev
mailing list