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: First Time Setup Wizard #3204

Merged

Conversation

michael-genson
Copy link
Collaborator

@michael-genson michael-genson commented Feb 20, 2024

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

This PR adds a first time setup wizard. It was first proposed in #1164, but getting this ready before V1 would've been too much. Now that we're past V1, we're in a good place to add this sort of thing.

When a user logs-in as the default user (changeme@example.com), or they go to the root URL while logged-in with the default user (index), they are redirected to /admin/setup. Here they perform a few tasks:

  1. Change their email, username, and password
  2. Toggle public access
  3. Toggle seed data

Once that's complete, they're given a list of places to check out (e.g. migrations).

Here's a full walkthrough of the new setup wizard:

2024-02-20_16h24_00

I think there's more that can be done here to help new setups, but as-is I'm pretty happy with how it turned out, and adding-on to it should be pretty straight-forward.

Which issue(s) this PR fixes:

(REQUIRED)

N/A, idea comes from #1164

Fixes 2166

Special notes for your reviewer:

(fill-in or delete this section)

A few implementation notes:

  • In order to avoid having the user re-type their password (since they're going to be using the default password anyway) I added a sort of workaround to the update password route on the backend. If the user trying to update their password is the default user, and they don't provide the current password, we assume they meant to provide the default password. I added test cases for this
  • If the site is in demo mode, the setup page is skipped (as if you're not logging-in as the default user, even if you are)
  • I refactored the new user registration form so I didn't have to duplicate it here. Hopefully I didn't make too much of a mess of things, but that was probably the hardest part of this PR, so take a look if you can. I did end-to-end testing to confirm registration still works as expected. I don't know if I used the form composable correctly, so definitely give that an extra look over

Testing

(fill-in or delete this section)

Added a backend test for the update password change, and did end to end testing for new instances as well as registrations (since that draws from the same code)

@boc-the-git boc-the-git linked an issue Feb 21, 2024 that may be closed by this pull request
@hay-kot hay-kot self-assigned this Mar 9, 2024
Copy link
Collaborator

@hay-kot hay-kot left a comment

Choose a reason for hiding this comment

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

Pulled down and tested, everything looks good to me besides my one comment about verifying the current password.

mealie/routes/users/crud.py Outdated Show resolved Hide resolved
@michael-genson
Copy link
Collaborator Author

It's lost in the merge commit but I removed the backend password stuff (I just let the OIDC PR overwrite the changes since there was a conflict there anyway)

@hay-kot hay-kot enabled auto-merge (squash) March 11, 2024 13:23
@hay-kot hay-kot merged commit 403038a into mealie-recipes:mealie-next Mar 11, 2024
10 checks passed
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.

[v1.0.0b] [Task] Prompt User For Action on Login (Reset Password)
2 participants