Skip to content
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

Merged
merged 5 commits into from
Aug 2, 2021
Merged

Username auto fill fix #285

merged 5 commits into from
Aug 2, 2021

Conversation

toth2000
Copy link
Contributor

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.

Copy link
Owner

@Coteh Coteh left a 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! :)

@@ -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();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const userName = $("#input-login-username").val();
const username = $("#input-login-username").val();

clearOverlay(e);
openRegister(e);
if (userName) $("#input-register-username").val(userName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (userName) $("#input-register-username").val(userName);
if (username) $("#input-register-username").val(username);

Copy link
Contributor Author

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.

clearOverlay(e);
openRegister(e);
if (userName) $("#input-register-username").val(userName);
Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Aug 1, 2021
Copy link
Owner

@Coteh Coteh left a 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.

assets/js/main.js Outdated Show resolved Hide resolved
@Coteh Coteh changed the base branch from master to development August 1, 2021 22:56
Co-authored-by: James Cote <[email protected]>
@toth2000
Copy link
Contributor Author

toth2000 commented Aug 2, 2021

@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.

Copy link
Owner

@Coteh Coteh left a 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! :)

@Coteh Coteh merged commit 6a5eee4 into Coteh:development Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants