Sha256: a94372500a7238fd9307560b753aa7e9d003beab773694e1ccf7fc2598cd4f5f

Contents?: true

Size: 889 Bytes

Versions: 4

Compression:

Stored size: 889 Bytes

Contents

module Devise
  class VerificationController < DeviseController
    prepend_before_action :authenticate_scope!

    def new
    end

    def create
      resource.assign_attributes(account_verification_params)

      if resource.valid_for_verification? && resource.save
        set_flash_message :notice, :verified
        redirect_to after_verification_path(resource)
      else
        render 'new'
      end
    end

    protected

    def after_verification_path(resource)
      '/'
    end

    # Authenticates the current scope and gets the current resource from the
    # session
    def authenticate_scope!
      send(:"authenticate_#{resource_name}!", force: true)
      self.resource = send(:"current_#{resource_name}")
    end

    def account_verification_params
      params.require(resource_name)
            .permit(resource_class.fields_for_verification)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devise-verifiable-1.0.0 app/controllers/devise/verification_controller.rb
devise-verifiable-0.0.3 app/controllers/devise/verification_controller.rb
devise-verifiable-0.0.2 app/controllers/devise/verification_controller.rb
devise-verifiable-0.0.1 app/controllers/devise/verification_controller.rb