diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb
index 0d53930bcd3..40608cc50d4 100644
--- a/app/controllers/about_controller.rb
+++ b/app/controllers/about_controller.rb
@@ -5,8 +5,9 @@ class AboutController < ApplicationController
before_filter :ensure_logged_in, only: [:live_post_counts]
def index
- @about = About.new
+ return redirect_to path('/login') if SiteSetting.login_required? && current_user.nil?
+ @about = About.new
respond_to do |format|
format.html do
render :index
diff --git a/app/views/static/show.html.erb b/app/views/static/show.html.erb
index 7716a696451..c941961795e 100644
--- a/app/views/static/show.html.erb
+++ b/app/views/static/show.html.erb
@@ -1,7 +1,9 @@
- - <%= link_to t('about'), '/about' %>
+ <% unless SiteSetting.login_required? && current_user.nil? %>
+ - <%= link_to t('about'), '/about' %>
+ <% end %>
<% if @faq_overriden %>
- ' href='<%= guidelines_path %>'><%= t 'guidelines' %>
- <%= t 'js.faq' %>
diff --git a/spec/controllers/about_controller_spec.rb b/spec/controllers/about_controller_spec.rb
new file mode 100644
index 00000000000..4589fda3510
--- /dev/null
+++ b/spec/controllers/about_controller_spec.rb
@@ -0,0 +1,26 @@
+require 'rails_helper'
+
+describe AboutController do
+
+ context '.index' do
+
+ it "should display the about page for anonymous user when login_required is false" do
+ SiteSetting.login_required = false
+ xhr :get, :index
+ expect(response).to be_success
+ end
+
+ it 'should redirect to login page for anonymous user when login_required is true' do
+ SiteSetting.login_required = true
+ xhr :get, :index
+ expect(response).to redirect_to '/login'
+ end
+
+ it "should display the about page for logged in user when login_required is true" do
+ SiteSetting.login_required = true
+ log_in
+ xhr :get, :index
+ expect(response).to be_success
+ end
+ end
+end