diff --git a/app/controllers/password_resets_controller.rb b/app/controllers/password_resets_controller.rb index ef92fce..4d6446d 100644 --- a/app/controllers/password_resets_controller.rb +++ b/app/controllers/password_resets_controller.rb @@ -14,7 +14,7 @@ class PasswordResetsController < ApplicationController reset_password_sent_at: Time.current ) PasswordResetMailer.reset(@user).deliver_later - else + elsif @user.present? @user.invite_by! InvitationMailer.invite(@user).deliver_later end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b75005a..4c31592 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -9,9 +9,6 @@ class SessionsController < ApplicationController end def create - # Skip authentication if rate limited - return if @rate_limited - user = User.find_by(email: params[:email]&.downcase&.strip) if user&.authenticate(params[:password]) @@ -50,6 +47,6 @@ class SessionsController < ApplicationController current_user&.forget_me if cookies.signed[:remember_token] reset_session cookies.delete(:remember_token) - redirect_to root_path, notice: "You have been logged out." + redirect_to root_path, notice: "You have been logged out.", status: :see_other end end diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index 1d2be47..d26660a 100644 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -28,7 +28,7 @@ <% if admin? %> <%= link_to "Admin", admin_root_path, class: "bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-indigo-700 transition" %> <% end %> - <%= link_to "Sign Out", logout_path, data: { turbo_method: :delete, turbo: false }, + <%= link_to "Sign Out", logout_path, data: { turbo_method: :delete }, class: "text-sm font-medium text-slate-600 hover:text-red-600 transition" %> <% else %> @@ -74,8 +74,8 @@ <% if admin? %> <%= link_to "Admin", admin_root_path, class: "px-2 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50 rounded transition" %> <% end %> - <%= link_to "Sign Out", logout_path, data: { turbo_method: :delete, turbo: false }, - class: "px-2 py-2 text-sm font-medium text-red-600 hover:bg-red-50 rounded transition" %> + <%= link_to "Sign Out", logout_path, data: { turbo_method: :delete }, + class: "block px-2 py-2 text-sm font-medium text-red-600 hover:bg-red-50 rounded transition" %> <% else %> <%= link_to "Sign In", login_path, class: "px-2 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-50 rounded transition" %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a266e2c..e6ea5de 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,7 +19,7 @@ Rails.application.routes.draw do # Authentication routes get "login", to: "sessions#new", as: :login post "login", to: "sessions#create" - get "logout", to: "sessions#destroy", as: :logout + delete "logout", to: "sessions#destroy", as: :logout # Password reset routes resources :password_resets, only: [ :new, :create ]