More reliable team invites and password resets
Invite links, first-time setup, and password resets now take cleaner paths, especially for staff found in imported deal history.
Changes & improvements
This patch tightens the path from "invite sent" to "staff member can actually get in", especially for salespeople who already appear in imported deal history but have not finished creating an account.
Invite links are more forgiving
The invite acceptance page now handles both Supabase link formats we can receive from email. That keeps fresh links from incorrectly dropping into the expired-link state when the token arrives as a callback code rather than a URL hash.
If an invite lands on an account shell that exists but has no completed profile name, Autopilot now treats that person as still needing first-time setup and sends them to set their password properly.
Password reset is separate from first-time setup
Password reset emails now open a dedicated reset-password page. That page only asks for the new password.
The set-password page stays focused on first-time invited users, where the person may still need to enter their full name as well as create a password.
Unlinked staff and deals are preserved
When an invited person matches an unlinked staff row from imported deals, acceptance can attach that pending staff row to the real account and keep the assigned deals with them.
Resent invites also preserve the pending staff name, so managers can keep using the Team settings screen to link imported deal history to the right person.
Smaller fixes
- The expired-link screen now says the link could not be used instead of assuming every failure means an expired invite.
- Invite acceptance now runs in the same helper after invite callback, normal login, and first app load, so the app does not rely on one fragile path.
- Half-created invited users are handled as setup-incomplete rather than silently becoming active team members with blank display names.