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

Feature/user auth flow #25

Merged
merged 8 commits into from
Sep 9, 2020
Merged

Feature/user auth flow #25

merged 8 commits into from
Sep 9, 2020

Conversation

Sirbuland
Copy link
Collaborator

This PR is implementing following functionalities:

  1. JS based form submission for login sign up of user
  2. Overriding of Devise controllers so that normal flow of authentication still work
  3. Design/styling of authentication pages as well as design of modal for authentication which is part of navbar.
  4. Specs for testing of normal as well as JS based request flows for devise controllers.

this.signoutButtonTarget.addEventListener("ajax:success", (event) =>
this.signoutUserHandler(event)
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what's with the guards on these? Are there times when these targets don't exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@hcatlin yeah these are alternative when user logged in loginButtonTarget & hasSignupButtonTarget doesn't exist. And when use is not login signoutButtonTarget doesn't exist.

Copy link
Contributor

@HamptonMakes HamptonMakes left a comment

Choose a reason for hiding this comment

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

I think we can simplify this with data-actions!

createModal(response, target) {
this.modalLabelTarget.innerHTML =
target === "login" ? "Sign in to Veue" : "Create Account Veue";
document.body.style.overflowY = "hidden";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have to change the overflow on the body when this shows up? I'd at least document this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@hcatlin we change overflowY to stop background page scroll otherwise it will scroll while showing model.

- else
%ul
%li
= link_to "Login", "javascript:void(0)", class: "list-item", data: { target: "authentication.loginButton" }
Copy link
Contributor

Choose a reason for hiding this comment

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

OH! I think you really want data-actions here! data: { action: "click->authentication.login" }

Copy link
Contributor

Choose a reason for hiding this comment

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

This explains why you have that whole wiring up event listeners if statements... none of that is needed!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm ok. I'll change it and update PR shortly.

@@ -4,6 +4,8 @@ class ApplicationController < ActionController::Base
include HttpAuthConcern
include DeviseHelperConcern

protect_from_forgery unless: -> { request.format.json? }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a TODO here to remove this? Big security hole!

@Sirbuland Sirbuland merged commit d499246 into main Sep 9, 2020
@HamptonMakes HamptonMakes deleted the feature/user_auth_flow branch September 23, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants