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; } 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 d2ea59d5433..4971cd49c7c 100644 --- a/app/views/static/login.en.html.erb +++ b/app/views/static/login.en.html.erb @@ -1,13 +1 @@ -
- -- 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.