Class: Devise::ParanoidVerificationCodeController

Inherits:
DeviseController
  • Object
show all
Defined in:
app/controllers/devise/paranoid_verification_code_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_paranoid_verification_code_update_path_for(_resource) ⇒ String, Symbol

Allows you to customize where the user is redirected to after the update action successfully completes.

Defaults to the request’s original path, and then root if that is nil.

Parameters:

  • resource (ActiveModel::Model)

    Devise resource model for logged in user.

Returns:

  • (String, Symbol)

    The path that the user will be redirected to.



32
33
34
# File 'app/controllers/devise/paranoid_verification_code_controller.rb', line 32

def after_paranoid_verification_code_update_path_for(_resource)
  stored_location_for(scope) || :root
end

#showObject



9
10
11
# File 'app/controllers/devise/paranoid_verification_code_controller.rb', line 9

def show
  respond_with(resource)
end

#updateObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/devise/paranoid_verification_code_controller.rb', line 13

def update
  if resource.verify_code(resource_params[:paranoid_verification_code])
    warden.session(scope)['paranoid_verify'] = false
    set_flash_message :notice, :updated
     resource, scope: scope
    respond_with({}, location: after_paranoid_verification_code_update_path_for(resource))
  else
    respond_with(resource, action: :show)
  end
end