FEATURE: send set password instructions after invite redemption

This commit is contained in:
Arpit Jalan
2014-10-10 21:17:52 +05:30
parent e8637344c3
commit 861f321263
5 changed files with 68 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ InviteRedeemer = Struct.new(:invite, :username, :name) do
send_welcome_message
approve_account_if_needed
notify_invitee
send_password_instructions
end
def invite_was_redeemed?
@@ -102,6 +103,12 @@ InviteRedeemer = Struct.new(:invite, :username, :name) do
invited_user.approve(invite.invited_by_id, false)
end
def send_password_instructions
if !SiteSetting.enable_sso && SiteSetting.enable_local_logins && !invited_user.has_password?
Jobs.enqueue(:invite_password_instructions_email, username: invited_user.username)
end
end
def notify_invitee
invite.invited_by.notifications.create(notification_type: Notification.types[:invitee_accepted],
data: {display_username: invited_user.username}.to_json)