diff options
author | Valery Sizov <valery@gitlab.com> | 2015-01-16 18:48:10 -0800 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-01-16 18:48:10 -0800 |
commit | 5c7edea624ae16cee91f4bff0754565e21e76eae (patch) | |
tree | b2546791b4cfd6a35f71acbce8245cd52b985780 | |
parent | ba74821d9c4e32577f9359e2b6f8b84975333303 (diff) | |
download | gitlab-ci-5c7edea624ae16cee91f4bff0754565e21e76eae.tar.gz |
OAuth2: config check
-rw-r--r-- | app/controllers/application_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/helps_controller.rb | 4 | ||||
-rw-r--r-- | app/views/helps/oauth2.haml | 24 | ||||
-rw-r--r-- | config/routes.rb | 4 |
4 files changed, 40 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 158893e..8f66b2c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,6 @@ class ApplicationController < ActionController::Base before_filter :default_headers + before_filter :check_config protect_from_forgery @@ -61,4 +62,12 @@ class ApplicationController < ActionController::Base headers['X-Frame-Options'] = 'DENY' headers['X-XSS-Protection'] = '1; mode=block' end + + def check_config + if GitlabCi.config.gitlab_server.url.empty? + redirect_to oauth2_help_path + end + rescue Settingslogic::MissingSetting, NoMethodError + redirect_to oauth2_help_path + end end diff --git a/app/controllers/helps_controller.rb b/app/controllers/helps_controller.rb index f4320a1..e0fbe91 100644 --- a/app/controllers/helps_controller.rb +++ b/app/controllers/helps_controller.rb @@ -1,6 +1,10 @@ class HelpsController < ApplicationController before_filter :authenticate_user! + skip_filter :check_config def show end + + def oauth2 + end end diff --git a/app/views/helps/oauth2.haml b/app/views/helps/oauth2.haml new file mode 100644 index 0000000..f11654a --- /dev/null +++ b/app/views/helps/oauth2.haml @@ -0,0 +1,24 @@ +.jumbotron + %h2 + Please configure GitLab CI properly + + %p + GitLab CI integrates with your GitLab installation and run tests for your projects. + GitLab CI uses GitLab application for authorization this is why you should fill the config file out with + an url to the GitLab, an application id and an application secret. + + + +.bs-callout.bs-callout-danger + %h4 + = link_to 'https://gitlab.com/gitlab-org/gitlab-ci/issues' do + %i.icon-bug + Issue tracker + %p Reports about recent bugs and problems.. + +.bs-callout.bs-callout-warning + %h4 + = link_to 'http://feedback.gitlab.com/forums/176466-general/category/64310-gitlab-ci' do + %i.icon-thumbs-up + Feedback forum + %p Suggest improvements or new features for GitLab CI. diff --git a/config/routes.rb b/config/routes.rb index 40a73fd..fcb2d4a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,9 @@ GitlabCi::Application.routes.draw do API::API.logger Rails.logger mount API::API => '/api' - resource :help + resource :help do + get :oauth2 + end resources :projects do collection do |