Class: DeviseTokenAuth::ConfirmationsController
- Inherits:
-
ApplicationController
- Object
- DeviseController
- ApplicationController
- DeviseTokenAuth::ConfirmationsController
- Defined in:
- app/controllers/devise_token_auth/confirmations_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#resource_data, #resource_errors
Instance Method Details
#show ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/devise_token_auth/confirmations_controller.rb', line 3 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! yield @resource if block_given? 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 |