houdini/lib/notify/notify_user.rb

16 lines
569 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2020-06-12 20:03:43 +00:00
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
module NotifyUser
def self.send_confirmation_email(user_id)
ParamValidation.new({ user_id: user_id }, user_id: { required: true, is_integer: true })
user = User.where('id = ?', user_id).first
unless user
raise ParamValidation::ValidationError.new("#{user_id} is not a valid user id", key: :user_id, val: user_id)
end
user.send_confirmation_instructions
end
end