Sha256: 35dd9760be88c50df3d1e60687ef012bb3c3ca2cfb00fddab1c562bed7b968a0

Contents?: true

Size: 1011 Bytes

Versions: 26

Compression:

Stored size: 1011 Bytes

Contents

module DeviseTokenAuth
  class ConfirmationsController < DeviseTokenAuth::ApplicationController
    def show
      @resource = resource_class.confirm_by_token(params[:confirmation_token])

      if @resource and @resource.id
        # create client id
        client_id  = SecureRandom.urlsafe_base64(nil, false)
        token      = SecureRandom.urlsafe_base64(nil, false)
        token_hash = BCrypt::Password.create(token)
        expiry     = (Time.now + DeviseTokenAuth.token_lifespan).to_i

        @resource.tokens[client_id] = {
          token:  token_hash,
          expiry: expiry
        }

        @resource.save!

        redirect_to(@resource.build_auth_url(params[:redirect_url], {
          token:                        token,
          client_id:                    client_id,
          account_confirmation_success: true,
          config:                       params[:config]
        }))
      else
        raise ActionController::RoutingError.new('Not Found')
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
cm-devise_token_auth-0.1.30.1 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta10 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta9 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta8 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta7 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta6 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta5 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta4 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta3 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta2 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.32.beta1 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta10 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta9 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta8 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta7 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta6 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta5 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta4 app/controllers/devise_token_auth/confirmations_controller.rb
devise_token_auth-0.1.31.beta3 app/controllers/devise_token_auth/confirmations_controller.rb