FEATURE: Restrict link invites to email domain (#15211)

Allow multiple emails to redeem a link invite only if the email domain
name matches the one specified in the link invite.
This commit is contained in:
Dan Ungureanu
2021-12-08 17:06:57 +02:00
committed by GitHub
parent e1b4e2e034
commit d8fe0f4199
12 changed files with 119 additions and 13 deletions

View File

@ -134,6 +134,7 @@ class InvitesController < ApplicationController
begin
invite = Invite.generate(current_user,
email: params[:email],
domain: params[:domain],
skip_email: params[:skip_email],
invited_by: current_user,
custom_message: params[:custom_message],
@ -210,6 +211,17 @@ class InvitesController < ApplicationController
Invite.emailed_status_types[:not_required]
end
end
invite.domain = nil if invite.email.present?
end
if params.has_key?(:domain)
invite.domain = params[:domain]
if invite.domain.present?
invite.email = nil
invite.emailed_status = Invite.emailed_status_types[:not_required]
end
end
if params[:send_email]