mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-09 09:13:02 +03:00
[PR #295] [MERGED] Add Email Invite Functionality #3762
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/295
Author: @njfox
Created: 12/16/2018
Status: ✅ Merged
Merged: 12/21/2018
Merged by: @dani-garcia
Base:
master← Head:invite_emails📝 Commits (10+)
680f5e8Add Invite JWT struct and supporting functionse2907f4Add invite email functionalityd428120Add email_invitations config option4910b14Implement email invitations and registration workflowe245e96Fix broken rebase042c107Remove CONFIG.email_invitation option9479108Remove CONFIG.email_invitations26bf7bcUse upstream jslib invite/registration workflow99256b9Prefix unused params with underscore2cd736aValidate JWT if a user registers with SMTP invites enabled📊 Changes
6 files changed (+178 additions, -12 deletions)
View changed files
📝
BUILD.md(+3 -0)📝
Dockerfile.alpine(+3 -1)📝
src/api/core/accounts.rs(+30 -9)📝
src/api/core/organizations.rs(+76 -2)📝
src/auth.rs(+37 -0)📝
src/mail.rs(+29 -0)📄 Description
This PR adds support for emailing invite tokens to users who are invited to organizations.
EMAIL_INVITATIONShas been added as a config option that, when enabled, will cause the /invite endpoint to generate a JWT which is valid for 5 days and email the user a link. When the user clicks the link, their UserOrganization status is set to "Accepted", which is what happened automatically before. The previous behavior is unchanged whenEMAIL_INVITATIONSis not explicitly enabled.Note the TODO in src/api/core/organizations.rs:511--currently, when the user clicks the invite link, they are just presented with a blank page. I couldn't figure out how to get redirection working in rocket but ideally they would be automatically redirected to the registration page with their email address pre-filled (ie something like
rocket::response::Redirect::to(format!("/#/register?email={}", invite_claims.email)).I think a good next step after getting the redirect working would be to email the user who sent the invitation to let them know it has been accepted, and it would be trivial to add to the new
#[get("/organizations/<org_id>/users/<org_user_id>/accept?<token>")]endpoint added in this PR.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.