mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 23:21:11 +08:00
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:
@ -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]
|
||||
|
Reference in New Issue
Block a user