Class: DeviseOtp::Devise::OtpPersistenceController

Inherits:
DeviseController
  • Object
show all
Includes:
Devise::Controllers::Helpers
Defined in:
app/controllers/devise_otp/devise/otp_persistence_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

makes the current browser persistent



19
20
21
22
23
24
25
# File 'app/controllers/devise_otp/devise/otp_persistence_controller.rb', line 19

def create
  if otp_set_trusted_device_for(resource)
    otp_set_flash_message :success, :successfully_set_persistence
  end

  redirect_to otp_token_path_for(resource)
end

#destroyObject

clears persistence for the current browser



30
31
32
33
34
35
36
# File 'app/controllers/devise_otp/devise/otp_persistence_controller.rb', line 30

def destroy
  if otp_clear_trusted_device_for(resource)
    otp_set_flash_message :success, :successfully_cleared_persistence
  end

  redirect_to otp_token_path_for(resource)
end

#resetObject

rehash the persistence secret, thus, making all the persistence cookies invalid



41
42
43
44
45
46
47
# File 'app/controllers/devise_otp/devise/otp_persistence_controller.rb', line 41

def reset
  if otp_reset_persistence_for(resource)
    otp_set_flash_message :notice, :successfully_reset_persistence
  end

  redirect_to otp_token_path_for(resource)
end

#showObject

fallback in case of redirect after authentication



12
13
14
# File 'app/controllers/devise_otp/devise/otp_persistence_controller.rb', line 12

def show
  redirect_to otp_token_path_for(resource)
end