From 0e722193733488b1b959ce7c417b4402a9f06b95 Mon Sep 17 00:00:00 2001 From: cryptogopher Date: Sat, 1 Apr 2023 18:53:30 +0200 Subject: [PATCH] Require authentication --- app/controllers/application_controller.rb | 1 + app/models/user.rb | 2 -- config/routes.rb | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..6b4dcfa 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,3 @@ class ApplicationController < ActionController::Base + before_action :authenticate_user! end diff --git a/app/models/user.rb b/app/models/user.rb index 9c27d47..916528d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,4 @@ class User < ApplicationRecord - # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable diff --git a/config/routes.rb b/config/routes.rb index 5f0abca..7363987 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do - devise_for :users + devise_for :users, path: '', path_names: {registration: 'register'} + resources :users - # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html root "users#index" end