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

feat(newspack-ui): integrate with sign in/sign up #2860

Merged
merged 45 commits into from
Jan 29, 2024

Conversation

miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Jan 16, 2024

All Submissions:

Changes proposed in this Pull Request:

This PR implements the Newspack UI to the Sign in/Sign up modal and introduces changes to allow the modal integration with other components from this project.

The modal logic has been decoupled from the authentication form logic, allowing the modal management to be more easily extended to support callbacks and other customizations.

The new modal logic exposes an openAuthModal( config ) to the reader activation library, which can be called by other components that can run a callback (another modal).

The configuration allows for the following customizations:

  • callback(message, data): function called after successful login
  • initialState: whether to open auth modal as register or signin
  • skipSuccess: whether to skip the final "success" state after login, close the modal and execute the callback immediately
  • labels: object containing custom labels for the auth form (modal title and button labels)
  • content: custom HTML to appear in the auth modal before the form

Asana tasks:

  • 1205234045751551-as-1205668937699522/f
  • 1205234045751551-as-1206405274735562/f
  • 1205234045751551-as-1205668937699526/f

Sign In

image

Password

image

OTP

image

Create an account

image

Successful sign in

image

Successful registration

image

Example of the openAuthModal( config ) for the modal checkout

The example below is drafted in Automattic/newspack-blocks#1647

image

How to test the changes in this Pull Request:

  1. Check out this branch and feat(modal-checkout): pre-modal authentication newspack-blocks#1647
  2. Confirm you have RAS enabled
  3. On a fresh session, click on "Sign in" and confirm the modal renders as in the image above
  4. Sign in with an existing reader account that has a configured password
  5. Confirm you are prompted to enter the password and can successfully login
  6. Click "Continue" and confirm you are redirected to the "My Account" page
  7. On another fresh session click to Sign In and attempt to login with a new email
  8. Confirm you get an error and clicking the "Create an account" link in the error message changes the form state
  9. Register with the new email, confirm you're signed in and get the "Successful registration" as represented in the image above
  10. Click to "Set a password" and confirm the email is sent and you are redirected to the My Account page with a notification
  11. Before setting a password, start another fresh session and sign in with the newly registered email
  12. Confirm you're prompted the enter the OTP
  13. Enter the OTP and confirm you sign in
  14. Set a password for the account, start a fresh session and sign in
  15. Confirm you're now prompted to set the password instead of an OTP

`openAuthModal( config )``

  1. Make sure you have feat(modal-checkout): pre-modal authentication newspack-blocks#1647
  2. On a fresh session, click to Donate using the donate block
  3. Confirm you are prompted to authenticate
  4. Authenticate and confirm the modal checkout appears
  5. Close the modal and click to donate again
  6. Confirm you're no longer prompted to authenticate and the modal checkout renders
  7. Repeat the same steps using the "Checkout Button" block and confirm it behaves the same

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Base automatically changed from feat/newspack-ui-modal-functionality to epic/ras-acc January 17, 2024 16:47
@miguelpeixe miguelpeixe changed the base branch from epic/ras-acc to chore/restructure-auth-js January 23, 2024 13:21
Base automatically changed from chore/restructure-auth-js to epic/ras-acc January 24, 2024 12:53
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Approving despite pushing my own changes since these are only small CSS fixes, refactoring, and removing some vestiges of AMP support.

@github-actions github-actions bot added the [Status] Approved The pull request has been reviewed and is ready to merge label Jan 29, 2024
@adekbadek adekbadek merged commit ff256ee into epic/ras-acc Jan 29, 2024
6 checks passed
@adekbadek adekbadek deleted the feat/newspack-ui-auth branch January 29, 2024 15:59
@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.0.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.1.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.2.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.6.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 3.9.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.1.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.2.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.4.0-epic-ras-acc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @epic/ras-acc [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants