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
27 28 29 30 31 |
# File 'app/controllers/devise_token_auth/confirmations_controller.rb', line 27 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 |
# 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 # generate new auth token token = SecureRandom.urlsafe_base64(nil, false) # set new token as user password @user.password = token @user.password_confirmation = token @user.save redirect_to generate_url(@user.confirm_success_url, { email: @user.email, auth_token: token }) else raise ActionController::RoutingError.new('Not Found') end end |