Repository navigation
Onboarding: Add a team setup step - #6822
Conversation
Makes the current TeamSetup LiveView handle both:
1. team setup from "My personal sites"
2. a new team creation from scratch
Also fixes the E2E test login utility which wasn't used before (getByLabel('Password') also matched with the login page's "Toggle password visibility").
When a user whose email has been invited to a team, or as a guest, signs up via the standard register form (not the email link), we redirect them to /sites instead of sending them through onboarding. On the /sites page, they see the invitation banner. This already works for team invitations, but only if the team has at least one site. This commit makes sure that even an invitation to a team *without sites* ends up triggering the redirect.
|
aerosol
left a comment
There was a problem hiding this comment.
Played with it on QA, looks nice. I also checked SSO account locally and it seems to behave well.
I'm not sure about the default flow now and trusting the domain parameter - see comments inline.
| label or is invalid according to the rules of `valid_suggestion?/1`. | ||
| """ | ||
| def suggested_name_from_domain(domain, user_name) when is_binary(domain) do | ||
| with [host | _] <- String.split(domain, ["/", ":"], parts: 2), |
There was a problem hiding this comment.
why :? it's disallowed via domain validation
| def mount(params, _session, socket) do | ||
| team = socket.assigns.current_team | ||
| onboarding? = params["flow"] == Flows.register() | ||
| domain = params["domain"] |
There was a problem hiding this comment.
We should verify if this is a site accessible to current user at this stage, so we never redirect to /arbitrary-input/installation etc.
| ) | ||
|
|
||
| def new(conn, params) do | ||
| flow = params["flow"] || PlausibleWeb.Flows.register() |
There was a problem hiding this comment.
It seems that since we default to /register it means visiting /sites/new (without any extra flow param) will always prompt for team creation, even if we're past that step?
There was a problem hiding this comment.
Yeah, you're right. While all the in-app "add site" links contain ?flow=provisioning, the user can still go to /sites/new by typing it in the URL manually. It should default to provisioning.
Defaulting to flow=register already affects master too (onboarding style UI with flow progress, a "Skip" button instead of "Back to sites"). But indeed, this PR makes it worse. A user on "My personal sites" would be prompted to create a team again.
The create_site_email (a reminder to people who've signed up but haven't added a site or created a team yet) currently links to a bare /sites/new. So changing the default now would lead all those email link clicks to the provisioning flow instead. I've now updated the link in the email with ?flow=register (and the redirect after register form login), but I'd give it a week or so before changing the default to make sure all sent out emails still lead to onboarding. 53c49d8
Changes
After adding a site (or skipping it), the onboarding flow now includes another optional step to create a team. If a site was added, it suggests a team name based on the site domain, using the label right before the public suffix and "humanizing" it.
Since adding a site can be skipped, we now need a new way to create a team from scratch. A
Teams.createfunction was added for that. TheTeamSetupLiveView now handles both cases:Teams.createends up being calledAs for the UI, it makes the team setup page follow the style of "Add new site" -- no footer, no global notices, no focus box. The differences between the existing "create a team" page and the onboarding one:
Tests
Changelog
Documentation
Dark mode