Commit 3b21174d authored by Paco Guzman's avatar Paco Guzman

Check if the Users table has exactly one user limiting the whole set

parent 3cb69f0c
...@@ -39,7 +39,7 @@ class SessionsController < Devise::SessionsController ...@@ -39,7 +39,7 @@ class SessionsController < Devise::SessionsController
# Handle an "initial setup" state, where there's only one user, it's an admin, # Handle an "initial setup" state, where there's only one user, it's an admin,
# and they require a password change. # and they require a password change.
def check_initial_setup def check_initial_setup
return unless User.count == 1 return unless User.limit(2).count == 1 # Count as much 2 to know if we have exactly one
user = User.admins.last user = User.admins.last
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment