More tests

Only one user can sign in - until this becomes multiuser
This commit is contained in:
2024-05-14 18:53:34 +01:00
parent ae7846e46e
commit 4c63480a1f
5 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
class RegistrationsController < Devise::RegistrationsController
before_action :one_user_registered?, only: [:new, :create]
protected
def one_user_registered?
if User.count == 1
if user_signed_in?
redirect_to root_path
else
redirect_to new_user_session_path
end
end
end
end