From 28aeb1d36c07fa8f79ab020b1cf444888b657d26 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Tue, 4 Jun 2013 18:20:03 -0700 Subject: [PATCH 1/3] Remove static navigation from login page --- app/views/static/login.en.html.erb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/static/login.en.html.erb b/app/views/static/login.en.html.erb index d2ea59d5433..0e46a54fdd3 100644 --- a/app/views/static/login.en.html.erb +++ b/app/views/static/login.en.html.erb @@ -1,10 +1,3 @@ - -

Welcome to <%= SiteSetting.title %>

From 3774808a6e3972c67f32df88b9952d28a7babcdb Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Tue, 4 Jun 2013 18:33:28 -0700 Subject: [PATCH 2/3] Redirect to '/' if OmniAuth login from '/login' --- .../javascripts/discourse/controllers/login_controller.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/login_controller.js b/app/assets/javascripts/discourse/controllers/login_controller.js index 15906f8933f..a84cb70f588 100644 --- a/app/assets/javascripts/discourse/controllers/login_controller.js +++ b/app/assets/javascripts/discourse/controllers/login_controller.js @@ -139,7 +139,11 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona } // Reload the page if we're authenticated if (options.authenticated) { - window.location.reload(); + if (window.location.pathname === '/login') { + window.location.pathname = '/'; + } else { + window.location.reload(); + } return; } From 3074300f76213398ae83398666caeee9ae8e2cb7 Mon Sep 17 00:00:00 2001 From: Chris Hunt Date: Tue, 4 Jun 2013 18:53:36 -0700 Subject: [PATCH 3/3] Allow customization of 'login required' message --- app/models/site_content.rb | 1 + app/views/static/login.en.html.erb | 7 +------ config/locales/server.en.yml | 11 +++++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/models/site_content.rb b/app/models/site_content.rb index e4aa2ada8d1..ee8484aa140 100644 --- a/app/models/site_content.rb +++ b/app/models/site_content.rb @@ -17,6 +17,7 @@ class SiteContent < ActiveRecord::Base add_content_type :education_new_reply, default_18n_key: 'education.new-reply' add_content_type :tos_user_content_license, default_18n_key: 'terms_of_service.user_content_license' add_content_type :tos_miscellaneous, default_18n_key: 'terms_of_service.miscellaneous' + add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message' def site_content_type @site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym} diff --git a/app/views/static/login.en.html.erb b/app/views/static/login.en.html.erb index 0e46a54fdd3..4971cd49c7c 100644 --- a/app/views/static/login.en.html.erb +++ b/app/views/static/login.en.html.erb @@ -1,6 +1 @@ -

Welcome to <%= SiteSetting.title %>

- -

- We are excited to have you participate in <%= SiteSetting.title %>. Please - create an account or login to continue. -

+<%= markdown_content(:login_required_welcome_message) %> diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 20884d459cd..60e81c0d642 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -405,6 +405,12 @@ en: welcome_invite: title: "Welcome: Invited User" description: "A private message automatically sent to all new invited users when they accept the invitation from another user to participate." + + login_required_welcome_message: + title: "Login Required: Welcome Message" + description: "Welcome message that is displayed to logged out users when + the 'login required' setting is enabled." + tos_user_content_license: title: "Terms of Service: Content License" description: "The text for the Content License section of the Terms of Service." @@ -978,6 +984,11 @@ en: search_title: "Search for this topic" search_google: "Search Google" + login_required: + welcome_message: | + #[Welcome to %{title}](#welcome) + We are excited to have you participate in %{title}. Please create an account or login to continue. + terms_of_service: user_content_license: | User contributions are licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US). Without limiting any of those representations or warranties, %{company_short_name} has the right (though not the obligation) to, in %{company_short_name}’s sole discretion (i) refuse or remove any content that, in %{company_short_name}’s reasonable opinion, violates any %{company_short_name} policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in %{company_short_name}’s sole discretion. %{company_short_name} will have no obligation to provide a refund of any amounts previously paid.