Commit dd215d79 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'fix-relative-url-omniauth' into 'master'

Only include base URL in OmniAuth full_host parameter

Closes #2335

See merge request !1187
parents e449426a 4016a457
......@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased)
- Fix Error 500 in API when accessing a group that has an avatar (Stan Hu)
- Remove user OAuth tokens from the database and request new tokens each session (Stan Hu)
- Only include base URL in OmniAuth full_host parameter (Stan Hu)
- Only show recent push event if the branch still exists or a recent merge request has not been created (Stan Hu)
- Remove satellites
- Better performance for web editor (switched from satellites to rugged)
......
......@@ -32,14 +32,12 @@ class Settings < Settingslogic
end
end
def build_base_gitlab_url
base_gitlab_url.join('')
end
def build_gitlab_url
custom_port = gitlab_on_standard_port? ? nil : ":#{gitlab.port}"
[ gitlab.protocol,
"://",
gitlab.host,
custom_port,
gitlab.relative_url_root
].join('')
(base_gitlab_url + [gitlab.relative_url_root]).join('')
end
# check that values in `current` (string or integer) is a contant in `modul`.
......@@ -64,6 +62,17 @@ class Settings < Settingslogic
end
value
end
private
def base_gitlab_url
custom_port = gitlab_on_standard_port? ? nil : ":#{gitlab.port}"
[ gitlab.protocol,
"://",
gitlab.host,
custom_port
]
end
end
end
......@@ -123,6 +132,7 @@ Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].ni
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
Settings.gitlab['email_display_name'] ||= "GitLab"
Settings.gitlab['email_reply_to'] ||= "noreply@#{Settings.gitlab.host}"
Settings.gitlab['base_url'] ||= Settings.send(:build_base_gitlab_url)
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['user_home'] ||= begin
......
......@@ -11,7 +11,7 @@ if Gitlab::LDAP::Config.enabled?
end
end
OmniAuth.config.full_host = Settings.gitlab['url']
OmniAuth.config.full_host = Settings.gitlab['base_url']
OmniAuth.config.allowed_request_methods = [:post]
#In case of auto sign-in, the GET method is used (users don't get to click on a button)
OmniAuth.config.allowed_request_methods << :get if Gitlab.config.omniauth.auto_sign_in_with_provider.present?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment