-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Username auto fill fix #285
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @toth2000! I have left some feedback for you to address if you can. Thanks! :)
assets/js/main.js
Outdated
@@ -238,8 +238,10 @@ function onLoginLoaded(err) { | |||
setScalableWidth($("#overlay-container").get(0), 300); | |||
setScalableHeight($("#overlay-container").get(0), 450); | |||
$("#register-via-login-button").click(function(e) { | |||
const userName = $("#input-login-username").val(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const userName = $("#input-login-username").val(); | |
const username = $("#input-login-username").val(); |
assets/js/main.js
Outdated
clearOverlay(e); | ||
openRegister(e); | ||
if (userName) $("#input-register-username").val(userName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (userName) $("#input-register-username").val(userName); | |
if (username) $("#input-register-username").val(username); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make the suggested changes.
assets/js/main.js
Outdated
clearOverlay(e); | ||
openRegister(e); | ||
if (userName) $("#input-register-username").val(userName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it on macOS Firefox and it doesn't seem to work. I believe that you need to wait until the registration form is actually loaded onto the screen, then you can hook onto the element using jQuery after that. I recommend creating a callback parameter in openRegister
function, invoke the callback if it's not undefined inside thee req.onload
callback, then on line 243 where openRegister
is called, pass a callback that contains this line in it.
I'm not sure why I pass e
into openRegister
function call, I believe some of the functions in that file operate on the target element, but that function does not appear to do anything with e
so you can discard it and put the callback in there instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will look into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Coteh made the changes as suggested but I couldn't test as I am facing issues while setting the project on my local device.
Do let me know after checking if any further changes are required. Hope it will work now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! And it works on my end as well! Left one more comment for you to look at.
Also, what issue are you running into with setting the project up locally? I just opened up the Discussions section on this repo, so we can take the discussion there if you like.
Co-authored-by: James Cote <[email protected]>
@Coteh made the changes as suggested. I will try once more setting up the project and if I face any issue then I will create a discussion post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for your contribution! :)
Fixes Issue #277
Description
User name now auto-fills at register box if the user enters username in the username field of the login box and clicks the Register button.