From 0919a26686d4d486fbeb7983315f00ba8682c51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=B6hm?= Date: Sun, 25 Aug 2024 21:26:35 +0200 Subject: [PATCH] Changed authorize to authorize_user! --- app/controllers/application_controller.rb | 4 ++-- app/controllers/home_controller.rb | 2 +- app/controllers/identity/email_verifications_controller.rb | 3 +-- app/controllers/identity/password_resets_controller.rb | 3 +-- app/controllers/registrations_controller.rb | 2 +- app/controllers/sessions_controller.rb | 3 +-- app/controllers/vehicles_controller.rb | 2 +- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b1ec843..154e651 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,6 @@ class ApplicationController < ActionController::Base before_action :set_current_request_details - before_action :authenticate + before_action :authenticate_user! private def current_user @@ -19,7 +19,7 @@ class ApplicationController < ActionController::Base end helper_method :user_signed_in? - def authenticate + def authenticate_user! unless user_signed_in? redirect_to sign_in_path end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ce7e2f6..ac708b6 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < ApplicationController - skip_before_action :authenticate + skip_before_action :authenticate_user! def index end end diff --git a/app/controllers/identity/email_verifications_controller.rb b/app/controllers/identity/email_verifications_controller.rb index 5c48dc1..706ec34 100644 --- a/app/controllers/identity/email_verifications_controller.rb +++ b/app/controllers/identity/email_verifications_controller.rb @@ -1,6 +1,5 @@ class Identity::EmailVerificationsController < ApplicationController - skip_before_action :authenticate, only: :show - + skip_before_action :authenticate_user!, only: :show before_action :set_user, only: :show def show diff --git a/app/controllers/identity/password_resets_controller.rb b/app/controllers/identity/password_resets_controller.rb index 44583c1..f5f8bae 100644 --- a/app/controllers/identity/password_resets_controller.rb +++ b/app/controllers/identity/password_resets_controller.rb @@ -1,6 +1,5 @@ class Identity::PasswordResetsController < ApplicationController - skip_before_action :authenticate - + skip_before_action :authenticate_user! before_action :set_user, only: %i[ edit update ] def new diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 1126761..a80b849 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -1,5 +1,5 @@ class RegistrationsController < ApplicationController - skip_before_action :authenticate + skip_before_action :authenticate_user! def new @user = User.new diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 3abf69f..b00df06 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,6 +1,5 @@ class SessionsController < ApplicationController - skip_before_action :authenticate, only: %i[ new create ] - + skip_before_action :authenticate_user!, only: %i[ new create ] before_action :set_session, only: :destroy def index diff --git a/app/controllers/vehicles_controller.rb b/app/controllers/vehicles_controller.rb index e2b09f6..a7a339a 100644 --- a/app/controllers/vehicles_controller.rb +++ b/app/controllers/vehicles_controller.rb @@ -1,6 +1,6 @@ class VehiclesController < ApplicationController before_action :set_vehicle, only: %i[ show edit update destroy ] - skip_before_action :authenticate + skip_before_action :authenticate_user! # has_many_attached :images