From a287c86bc47166c832de05788c04439a6986b2d7 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Sun, 2 Feb 2020 23:07:38 +0545 Subject: [PATCH] Bugfix: Fix password reset (#455) --- .../confirmations_controller.rb | 2 +- .../{devise => devise_overrides}/passwords_controller.rb | 2 +- .../{devise => devise_overrides}/sessions_controller.rb | 2 +- .../token_validations_controller.rb | 2 +- config/routes.rb | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) rename app/controllers/{devise => devise_overrides}/confirmations_controller.rb (93%) rename app/controllers/{devise => devise_overrides}/passwords_controller.rb (95%) rename app/controllers/{devise => devise_overrides}/sessions_controller.rb (58%) rename app/controllers/{devise => devise_overrides}/token_validations_controller.rb (66%) diff --git a/app/controllers/devise/confirmations_controller.rb b/app/controllers/devise_overrides/confirmations_controller.rb similarity index 93% rename from app/controllers/devise/confirmations_controller.rb rename to app/controllers/devise_overrides/confirmations_controller.rb index 97b6d223d..96d16eafe 100644 --- a/app/controllers/devise/confirmations_controller.rb +++ b/app/controllers/devise_overrides/confirmations_controller.rb @@ -1,4 +1,4 @@ -class Devise::ConfirmationsController < Devise::ConfirmationsController +class DeviseOverrides::ConfirmationsController < Devise::ConfirmationsController skip_before_action :require_no_authentication, raise: false skip_before_action :authenticate_user!, raise: false diff --git a/app/controllers/devise/passwords_controller.rb b/app/controllers/devise_overrides/passwords_controller.rb similarity index 95% rename from app/controllers/devise/passwords_controller.rb rename to app/controllers/devise_overrides/passwords_controller.rb index cd1977647..adea8687d 100644 --- a/app/controllers/devise/passwords_controller.rb +++ b/app/controllers/devise_overrides/passwords_controller.rb @@ -1,4 +1,4 @@ -class Devise::PasswordsController < Devise::PasswordsController +class DeviseOverrides::PasswordsController < Devise::PasswordsController include AuthHelper skip_before_action :require_no_authentication, raise: false diff --git a/app/controllers/devise/sessions_controller.rb b/app/controllers/devise_overrides/sessions_controller.rb similarity index 58% rename from app/controllers/devise/sessions_controller.rb rename to app/controllers/devise_overrides/sessions_controller.rb index f2497de28..8ef7f2d11 100644 --- a/app/controllers/devise/sessions_controller.rb +++ b/app/controllers/devise_overrides/sessions_controller.rb @@ -1,4 +1,4 @@ -class Devise::SessionsController < ::DeviseTokenAuth::SessionsController +class DeviseOverrides::SessionsController < ::DeviseTokenAuth::SessionsController # Prevent session parameter from being passed # Unpermitted parameter: session wrap_parameters format: [] diff --git a/app/controllers/devise/token_validations_controller.rb b/app/controllers/devise_overrides/token_validations_controller.rb similarity index 66% rename from app/controllers/devise/token_validations_controller.rb rename to app/controllers/devise_overrides/token_validations_controller.rb index bd3d4bea3..b9830d79d 100644 --- a/app/controllers/devise/token_validations_controller.rb +++ b/app/controllers/devise_overrides/token_validations_controller.rb @@ -1,4 +1,4 @@ -class Devise::TokenValidationsController < ::DeviseTokenAuth::TokenValidationsController +class DeviseOverrides::TokenValidationsController < ::DeviseTokenAuth::TokenValidationsController def validate_token # @resource will have been set by set_user_by_token concern if @resource diff --git a/config/routes.rb b/config/routes.rb index 1b67f0bd4..b1883af40 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,12 @@ Rails.application.routes.draw do # AUTH STARTS match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post] - mount_devise_token_auth_for 'User', at: 'auth', controllers: { confirmations: 'devise/confirmations', passwords: 'devise/passwords', - sessions: 'devise/sessions', - token_validations: 'devise/token_validations' }, via: [:get, :post] + mount_devise_token_auth_for 'User', at: 'auth', controllers: { + confirmations: 'devise_overrides/confirmations', + passwords: 'devise_overrides/passwords', + sessions: 'devise_overrides/sessions', + token_validations: 'devise_overrides/token_validations' + }, via: [:get, :post] root to: 'dashboard#index'