twenty
twenty copied to clipboard
Ability to invite team members
Now that we've implemented a couple emails already (e.g. reset password), it should be easier to work on that issue so I'm recreating it.
What
We don't need too advanced features so it's not worth creating a dedicated table imo.
Instead, we should leverage the existing appToken table, introducing new types TEAM_INVITE_EMAIL
/ TEAM_INVITE_LINK
.
It's a bit of a hack but let's also store the invited email in value
column, it could be useful for debugging.
- We need to create an endpoint to invite a team member that will generate a token + send the invite email. That endpoint should work like the blocklist where we can pass comma separated values (didn't check if the comma -> array transformation was done on the backend or frontend for the blocklist)
- We should deprecate the inviteHash column and move this to an appToken instead
- Instead, we'll need to create an endpoint to refresh the invite link upon visiting the page if it's more than a day old (and invite link should last 7 days)
- We should adapt the sign-in/signup flow to work with appTokens instead of inviteHash. We should invalidate an email invites when used (but invite link can be used more than once).
- We should invalidate tokens sent by a user when that user is deleted
Design
Email invite: https://www.figma.com/file/VGTiOVcupSk2ciGtEdh2uY/Team-Invite?type=design&node-id=0%3A1&mode=design&t=Qoa8BULoaavpGCDx-1
Invite form in settings: https://www.figma.com/file/VGTiOVcupSk2ciGtEdh2uY/Team-Invite?type=design&node-id=5-1798&mode=design&t=idqoLtegZB0DNcrh-0
cc @Bonapara
Not part of this issue
Later on we should give people a way to revoke/disable tokens, especially the never-expiring token (invite link). T We will also introduce a step in the modal onboarding flow to encourage people to invite team members during that flow