From a2a9e1312b582e4f7b6e4cfb47b0d1f75aa53f5a Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 2 Apr 2024 14:37:53 -0500 Subject: [PATCH] Access no longer allowed unless signed in. Also hid the nav bar unless signed in. --- Makefile | 4 ++++ app/controllers/application_controller.rb | 1 + app/views/devise/shared/_links.html.erb | 4 ---- app/views/layouts/application.html.erb | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 91e7ae2..b5cd076 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,10 @@ version: reset: git reset --hard +#This opens a secure shell on test.obdev.io (ssh jcarr@test.obdev.io) +#This opens screen (screen -d) disconnect (screen -a -r) connect +#To copy the database info (scp "filename") found in storage + # gem 'devise' # bundle install # rails generate devise:install diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..cd7f6aa 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/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index ae79915..800cb2b 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -4,10 +4,6 @@ <%= link_to "Log in", new_session_path(resource_name), class: "btn btn-link" %> <% end %> - <%- if devise_mapping.registerable? && controller_name != 'registrations' %> - <%= link_to "Sign up", new_registration_path(resource_name), class: "btn btn-link" %> - <% end %> - <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%= link_to "Forgot your password?", new_password_path(resource_name), class: "btn btn-link" %> <% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2440158..8dc7301 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,7 +14,9 @@ - <%= render 'layouts/navbar' %> + <% if user_signed_in? %> + <%= render 'layouts/navbar' %> + <% end %>
<%= yield %>