mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 19:38:24 +00:00
FIX: new sites would get enable_google_logins true, should be false now
This commit is contained in:
parent
867c56d9c7
commit
8f76b76cf3
@ -113,9 +113,13 @@ users:
|
||||
client: true
|
||||
default: 8
|
||||
block_common_passwords: true
|
||||
|
||||
# The default value of enable_google_logins changed from true to false.
|
||||
# See db/migrate/20140521220115_google_openid_default_has_changed.rb
|
||||
enable_google_logins:
|
||||
client: true
|
||||
default: false
|
||||
|
||||
enable_google_oauth2_logins:
|
||||
client: true
|
||||
default: true
|
||||
|
@ -1,9 +1,13 @@
|
||||
class GoogleOpenidDefaultHasChanged < ActiveRecord::Migration
|
||||
def up
|
||||
result = Category.exec_sql("SELECT count(*) FROM site_settings WHERE name = 'enable_google_logins'")
|
||||
if result[0]['count'].to_i == 0
|
||||
# The old default was true, so add a row to keep it that way.
|
||||
execute "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('enable_google_logins', 5, 't', now(), now())"
|
||||
users_count_query = User.exec_sql("SELECT count(*) FROM users")
|
||||
if users_count_query[0]['count'].to_i > 1
|
||||
# This is an existing site.
|
||||
result = User.exec_sql("SELECT count(*) FROM site_settings WHERE name = 'enable_google_logins'")
|
||||
if result[0]['count'].to_i == 0
|
||||
# The old default was true, so add a row to keep it that way.
|
||||
execute "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('enable_google_logins', 5, 't', now(), now())"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user