Sha256: f5cd9e00bb318c7d17e722fdaa5af46a59a8261526c6588f5395e06486a38090

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

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

      if @user and @user.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

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

        @user.save!

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

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
xing_backend_token_auth-0.1.32 test/dummy/app/controllers/overrides/confirmations_controller.rb
xing_backend_token_auth-0.1.31 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.30.beta3 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.30.beta2 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.30.beta1 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta7 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta6 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta5 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta4 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta3 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta2 test/dummy/app/controllers/overrides/confirmations_controller.rb
devise_token_auth-0.1.29.beta1 test/dummy/app/controllers/overrides/confirmations_controller.rb