Commit d7a3414a authored by Gabriel Mazetto's avatar Gabriel Mazetto

Change GeoNode routes to use url_helpers

parent c8d8000a
...@@ -66,13 +66,11 @@ class GeoNode < ActiveRecord::Base ...@@ -66,13 +66,11 @@ class GeoNode < ActiveRecord::Base
end end
def oauth_callback_url def oauth_callback_url
URI.join(uri, "#{uri.path}/", 'oauth/geo/callback').to_s Gitlab::Routing.url_helpers.oauth_geo_callback_url(url_helper_args)
end end
def oauth_logout_url(state) def oauth_logout_url(state)
logout_uri = URI.join(uri, "#{uri.path}/", 'oauth/geo/logout') Gitlab::Routing.url_helpers.oauth_geo_logout_url(url_helper_args.merge(state: state))
logout_uri.query = "state=#{state}"
logout_uri.to_s
end end
def missing_oauth_application? def missing_oauth_application?
...@@ -81,6 +79,14 @@ class GeoNode < ActiveRecord::Base ...@@ -81,6 +79,14 @@ class GeoNode < ActiveRecord::Base
private private
def url_helper_args
if relative_url_root
relative_url = relative_url_root.starts_with?('/') ? relative_url_root : "/#{relative_url_root}"
end
{ protocol: schema, host: host, port: port, script_name: relative_url }
end
def refresh_bulk_notify_worker_status def refresh_bulk_notify_worker_status
if Gitlab::Geo.primary? if Gitlab::Geo.primary?
Gitlab::Geo.bulk_notify_job.try(:enable!) Gitlab::Geo.bulk_notify_job.try(:enable!)
......
...@@ -53,11 +53,13 @@ Rails.application.routes.draw do ...@@ -53,11 +53,13 @@ Rails.application.routes.draw do
authorizations: 'oauth/authorizations' authorizations: 'oauth/authorizations'
end end
namespace :oauth, path: 'oauth/geo', controller: 'geo_auth', as: 'oauth_geo' do namespace :oauth do
scope path: 'geo', controller: :geo_auth, as: :geo do
get 'auth' get 'auth'
get 'callback' get 'callback'
get 'logout' get 'logout'
end end
end
# Autocomplete # Autocomplete
get '/autocomplete/users' => 'autocomplete#users' get '/autocomplete/users' => 'autocomplete#users'
......
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