Class: Booth::Core::Authenticators::Confirm

Inherits:
Object
  • Object
show all
Includes:
Logging, Calls
Defined in:
lib/booth/core/authenticators/confirm.rb

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/booth/core/authenticators/confirm.rb', line 13

def call
  raise 'Authenticator is already confirmed' if authenticator.confirmed_at

  log { 'Confirming Authenticator...' }
  authenticator.transaction do
    authenticator.update! sign_count:,
                          confirmed_at: Time.current
  end

  Tron.success :confirmation_successful
rescue ActiveRecord::ActiveRecordError => e
  error { e }
  Tron.failure :confirmation_failed
end