debian-mirror-gitlab/app/models/concerns/forced_email_confirmation.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
609 B
Ruby
Raw Normal View History

2022-03-02 08:16:31 +05:30
# frozen_string_literal: true
module ForcedEmailConfirmation
extend ActiveSupport::Concern
included do
attr_accessor :skip_confirmation_period_expiry_check
end
def force_confirm(args = {})
self.skip_confirmation_period_expiry_check = true
confirm(args)
ensure
self.skip_confirmation_period_expiry_check = nil
end
protected
# Override, from Devise::Models::Confirmable
# Link: https://github.com/heartcombo/devise/blob/main/lib/devise/models/confirmable.rb
def confirmation_period_expired?
return false if skip_confirmation_period_expiry_check
super
end
end