mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Disable external auths by default. Don't change settings for existing sites.
This commit is contained in:
parent
35834a9c40
commit
72abb6e274
3 changed files with 29 additions and 5 deletions
|
@ -127,20 +127,20 @@ users:
|
|||
|
||||
enable_google_oauth2_logins:
|
||||
client: true
|
||||
default: true
|
||||
default: false
|
||||
google_oauth2_client_id: ''
|
||||
google_oauth2_client_secret: ''
|
||||
enable_yahoo_logins:
|
||||
client: true
|
||||
default: true
|
||||
default: false
|
||||
enable_twitter_logins:
|
||||
client: true
|
||||
default: true
|
||||
default: false
|
||||
twitter_consumer_key: ''
|
||||
twitter_consumer_secret: ''
|
||||
enable_facebook_logins:
|
||||
client: true
|
||||
default: true
|
||||
default: false
|
||||
facebook_app_id: ''
|
||||
facebook_app_secret: ''
|
||||
enable_github_logins:
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
class DisableExternalAuthsByDefault < ActiveRecord::Migration
|
||||
|
||||
def enable_setting_if_default(name)
|
||||
result = User.exec_sql("SELECT count(*) count FROM site_settings WHERE name = '#{name}'")
|
||||
if result[0]['count'].to_i == 0
|
||||
execute "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('#{name}', 5, 't', now(), now())"
|
||||
end
|
||||
end
|
||||
|
||||
def up
|
||||
users_count_query = User.exec_sql("SELECT count(*) FROM users")
|
||||
if users_count_query[0]['count'].to_i > 1
|
||||
# existing site, so keep settings as they are
|
||||
enable_setting_if_default 'enable_yahoo_logins'
|
||||
enable_setting_if_default 'enable_google_oauth2_logins'
|
||||
enable_setting_if_default 'enable_twitter_logins'
|
||||
enable_setting_if_default 'enable_facebook_logins'
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# No need to undo
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
/*jshint maxlen:10000000 */
|
||||
Discourse.SiteSettingsOriginal = {"title":"Discourse Meta","logo_url":"/assets/logo.png","logo_small_url":"/assets/logo-single.png","traditional_markdown_linebreaks":false,"top_menu":"latest|new|unread|read|starred|categories","post_menu":"like|edit|flag|delete|share|bookmark|admin|reply","share_links":"twitter|facebook|google+|email","track_external_right_clicks":false,"must_approve_users":false,"ga_tracking_code":"UA-33736483-2","ga_domain_name":"","enable_long_polling":true,"polling_interval":3000,"anon_polling_interval":30000,"min_post_length":20,"max_post_length":16000,"min_topic_title_length":15,"max_topic_title_length":255,"min_private_message_title_length":2,"allow_uncategorized_topics":true,"min_search_term_length":3,"flush_timings_secs":5,"suppress_reply_directly_below":true,"email_domains_blacklist":"mailinator.com","email_domains_whitelist":null,"version_checks":true,"min_title_similar_length":10,"min_body_similar_length":15,"category_colors":"BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|283890","max_upload_size_kb":1024,"category_featured_topics":6,"favicon_url":"/assets/favicon.ico","dynamic_favicon":false,"uncategorized_name":"uncategorized","uncategorized_color":"AB9364","uncategorized_text_color":"FFFFFF","invite_only":false,"login_required":false,"min_password_length":8,"enable_local_logins":true,"enable_google_logins":true,"enable_yahoo_logins":true,"enable_twitter_logins":true,"enable_facebook_logins":true,"enable_cas_logins":false,"enable_github_logins":true,"enable_persona_logins":true,"educate_until_posts":2,"topic_views_heat_low":1000,"topic_views_heat_medium":2000,"topic_views_heat_high":5000,"min_private_message_post_length":5,"faq_url":"","tos_url":"","privacy_policy_url":"","authorized_extensions":".jpg|.jpeg|.png|.gif|.txt","relative_date_duration":14,"delete_removed_posts_after":24,"delete_user_max_post_age":7, "default_code_lang": "lang-auto", "suppress_uncategorized_badge": true};
|
||||
Discourse.SiteSettingsOriginal = {"title":"Discourse Meta","logo_url":"/assets/logo.png","logo_small_url":"/assets/logo-single.png","traditional_markdown_linebreaks":false,"top_menu":"latest|new|unread|read|starred|categories","post_menu":"like|edit|flag|delete|share|bookmark|admin|reply","share_links":"twitter|facebook|google+|email","track_external_right_clicks":false,"must_approve_users":false,"ga_tracking_code":"UA-33736483-2","ga_domain_name":"","enable_long_polling":true,"polling_interval":3000,"anon_polling_interval":30000,"min_post_length":20,"max_post_length":16000,"min_topic_title_length":15,"max_topic_title_length":255,"min_private_message_title_length":2,"allow_uncategorized_topics":true,"min_search_term_length":3,"flush_timings_secs":5,"suppress_reply_directly_below":true,"email_domains_blacklist":"mailinator.com","email_domains_whitelist":null,"version_checks":true,"min_title_similar_length":10,"min_body_similar_length":15,"category_colors":"BF1E2E|F1592A|F7941D|9EB83B|3AB54A|12A89D|25AAE2|0E76BD|652D90|92278F|ED207B|8C6238|231F20|808281|B3B5B4|283890","max_upload_size_kb":1024,"category_featured_topics":6,"favicon_url":"/assets/favicon.ico","dynamic_favicon":false,"uncategorized_name":"uncategorized","uncategorized_color":"AB9364","uncategorized_text_color":"FFFFFF","invite_only":false,"login_required":false,"min_password_length":8,"enable_local_logins":true,"enable_google_logins":false,"enable_google_oauth2_logins":false,"enable_yahoo_logins":false,"enable_twitter_logins":false,"enable_facebook_logins":false,"enable_cas_logins":false,"enable_github_logins":false,"educate_until_posts":2,"topic_views_heat_low":1000,"topic_views_heat_medium":2000,"topic_views_heat_high":5000,"min_private_message_post_length":5,"faq_url":"","tos_url":"","privacy_policy_url":"","authorized_extensions":".jpg|.jpeg|.png|.gif|.txt","relative_date_duration":14,"delete_removed_posts_after":24,"delete_user_max_post_age":7, "default_code_lang": "lang-auto", "suppress_uncategorized_badge": true};
|
||||
Discourse.SiteSettings = jQuery.extend(true, {}, Discourse.SiteSettingsOriginal);
|
||||
|
|
Loading…
Reference in a new issue