resend invitations
This commit is contained in:
@@ -29,6 +29,24 @@ class Admin::InvitationsController < Admin::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def resend
|
||||
@invitation = User.find(params[:id])
|
||||
|
||||
if @invitation.invitation_accepted_at.present?
|
||||
redirect_to admin_invitations_path, alert: "Cannot resend an accepted invitation."
|
||||
return
|
||||
end
|
||||
|
||||
@invitation.update!(
|
||||
invitation_token: SecureRandom.urlsafe_base64(32),
|
||||
invitation_sent_at: Time.current
|
||||
)
|
||||
|
||||
InvitationMailer.invite(@invitation).deliver_later
|
||||
|
||||
redirect_to admin_invitations_path, notice: "Invitation resent to #{@invitation.email}"
|
||||
end
|
||||
|
||||
def destroy
|
||||
@invitation = User.find(params[:id])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user