diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-16 16:01:15 -0800 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-16 16:01:15 -0800 |
| commit | 41d7be3ce1ae9a4bff93b62322f35989b6ad4cf6 (patch) | |
| tree | 804b510b0d4a05601395e8697402c6a3dfb4cddf /app/controllers/application_controller.rb | |
| parent | ada6c6080b2fa0d63003f8b29b5c32195254906d (diff) | |
| download | gitlab-ce-41d7be3ce1ae9a4bff93b62322f35989b6ad4cf6.tar.gz | |
Allow to specify home page for non logged-in users
Diffstat (limited to 'app/controllers/application_controller.rb')
| -rw-r--r-- | app/controllers/application_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b83de68c5d2..4780a7a2a9a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -48,6 +48,17 @@ class ApplicationController < ActionController::Base end end + def authenticate_user! + # If user is not signe-in and tries to access root_path - redirect him to landing page + if current_application_settings.home_page_url.present? + if current_user.nil? && controller_name == 'dashboard' && action_name == 'show' + redirect_to current_application_settings.home_page_url and return + end + end + + super + end + def log_exception(exception) application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace application_trace.map!{ |t| " #{t}\n" } |
