Sha256: 422b426dd830323b088f843bd0b9ef7031521b97833d16b0ab8b3e16f37056df
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module DeviseTokenAuth class ConfirmationsController < DeviseTokenAuth::ApplicationController def show @resource = resource_class.confirm_by_token(params[:confirmation_token]) if @resource && @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 + @resource.token_lifespan).to_i if @resource.sign_in_count > 0 expiry = (Time.now + 1.second).to_i end @resource.tokens[client_id] = { token: token_hash, expiry: expiry } sign_in(@resource) @resource.save! yield @resource if block_given? redirect_header_options = {account_confirmation_success: true} redirect_headers = build_redirect_headers(token, client_id, redirect_header_options) redirect_to(@resource.build_auth_url(params[:redirect_url], redirect_headers)) else raise ActionController::RoutingError.new('Not Found') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_token_auth-0.1.43.beta1 | app/controllers/devise_token_auth/confirmations_controller.rb |