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

Label override flags for dbAuth generator #7118

Conversation

redwoodjs-bot[bot]
Copy link

@redwoodjs-bot redwoodjs-bot bot commented Dec 12, 2022

Resolves #3555

Description
Adds optional flags username-label and password-label which set the form labels in the SignupPage, LoginPage, ForgotPasswordPage and ResetPasswordPage generated via the yarn rw g dbAuth command.

Adds prompts to get these labels from the user if not already passed in by the flags. Prompt default values are Username and Password

Example of the CLI prompting:
Recording 2022-10-04 at 20 30 03

These label values are also used to determine the name of the variables within the generated files. This means if you request that username-label be email then variables like usernameRef become emailRef. Thanks to @Tobbe for this good idea!

Outstanding

  • Snapshot tests to confirm correct labels
  • Update docs

* initial ability to pass label arguements

* Added remaining parameters to auth template files

* Added no default value check in order to pass tests

* Apply suggestions: reduce templateVars duplication

Co-authored-by: Tobbe Lundberg <[email protected]>

* Apply suggestions: replace ternary

Co-authored-by: Tobbe Lundberg <[email protected]>

* Added missing templateVars declaration

* Renamed template vars

* Renamed flags to include 'label', added prompts and used listr2 tasks for user interrogation

* Updated yarn.lock

* Added default values within  function

* Updated web authn page template - not tested

* Moved WebAuthn into listr

* Some tidying up

* Fix default webauthn flag value check

* Added enquirer option and other minor fixes

* Added tests for prompts

* Add web.app to the mocked getPaths

* Fix password label and add listr2 options to task handler

* Added snapshot tests

* Added --username-label and --password-label flags to the docs for rw g dbAuth

* Normalise paths within tests

* Added test for custom labels and webauthn enabled

* Add flags to prevent test project creation prompting the user

* Updated test project fixtures

* update snapshots and set mockfiles before test describe

* Customised auth variables similar to labels

* updated test fixtures

* Update test snapshots

* Updated to use customised variable names based on label option

* Add missing dbAuth command test

Co-authored-by: Tobbe Lundberg <[email protected]>
Co-authored-by: Rob Cameron <[email protected]>
@redwoodjs-bot redwoodjs-bot bot added cherry-pick release:feature This PR introduces a new feature labels Dec 12, 2022
@jtoar jtoar closed this Dec 13, 2022
@jtoar jtoar deleted the cherry-pick-next-21b6b51dd0e38d5891da1fed8e7c8ffefcdc3d8d branch January 22, 2023 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants