Welcome to mirror list, hosted at ThFree Co, Russian Federation.

forced_email_confirmation.rb « concerns « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 649400184e5a3dda720d99e5342ddc2285059a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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