Check if the Users table has exactly one user limiting the whole set
This commit is contained in:
parent
3cb69f0c0b
commit
3b21174d32
|
|
@ -39,7 +39,7 @@ class SessionsController < Devise::SessionsController
|
|||
# Handle an "initial setup" state, where there's only one user, it's an admin,
|
||||
# and they require a password change.
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue