Class: DeviseTokenAuth::ConfirmationsController
- Inherits:
-
Devise::ConfirmationsController
- Object
- Devise::ConfirmationsController
- DeviseTokenAuth::ConfirmationsController
- Includes:
- Devise::Controllers::Helpers
- Defined in:
- app/controllers/devise_token_auth/confirmations_controller.rb
Instance Method Summary collapse
Instance Method Details
#generate_url(url, params = {}) ⇒ Object
31 32 33 34 35 |
# File 'app/controllers/devise_token_auth/confirmations_controller.rb', line 31 def generate_url(url, params = {}) uri = URI(url) uri.query = params.to_query uri.to_s end |
#show ⇒ Object
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 |
# File 'app/controllers/devise_token_auth/confirmations_controller.rb', line 5 def show @user = User.confirm_by_token(params[:confirmation_token]) if @user sign_in @user # create client id @client_id = SecureRandom.urlsafe_base64(nil, false) @token = SecureRandom.urlsafe_base64(nil, false) @user.tokens[@client_id] = { token: BCrypt::Password.create(@token), expiry: Time.now + 2.weeks } @user.save redirect_to generate_url(@user.confirm_success_url, { token: @token, client_id: @client_id, email: @user.email }) else raise ActionController::RoutingError.new('Not Found') end end |