diff options
Diffstat (limited to 'config/routes/user.rb')
-rw-r--r-- | config/routes/user.rb | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/config/routes/user.rb b/config/routes/user.rb index e0ae264e2c0..e1eeec6f766 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -1,6 +1,6 @@ # Allows individual providers to be directed to a chosen controller # Call from inside devise_scope -def override_omniauth(provider, controller, path_prefix = '/users/auth') +def override_omniauth(provider, controller, path_prefix = "/users/auth") match "#{path_prefix}/#{provider}/callback", to: "#{controller}##{provider}", as: "#{provider}_omniauth_callback", @@ -11,31 +11,31 @@ end if Gitlab::Auth::LDAP::Config.enabled? devise_scope :user do Gitlab::Auth::LDAP::Config.available_servers.each do |server| - override_omniauth(server['provider_name'], 'ldap/omniauth_callbacks') + override_omniauth(server["provider_name"], "ldap/omniauth_callbacks") end end end -devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, - registrations: :registrations, - passwords: :passwords, - sessions: :sessions, - confirmations: :confirmations } +devise_for :users, controllers: {omniauth_callbacks: :omniauth_callbacks, + registrations: :registrations, + passwords: :passwords, + sessions: :sessions, + confirmations: :confirmations,} devise_scope :user do - get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error - get '/users/almost_there' => 'confirmations#almost_there' + get "/users/auth/:provider/omniauth_error" => "omniauth_callbacks#omniauth_error", :as => :omniauth_error + get "/users/almost_there" => "confirmations#almost_there" end -scope '-/users', module: :users do +scope "-/users", module: :users do resources :terms, only: [:index] do post :accept, on: :member post :decline, on: :member end end -scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do - scope(path: 'users/:username', +scope(constraints: {username: Gitlab::PathRegex.root_namespace_route_regex}) do + scope(path: "users/:username", as: :user, controller: :users) do get :calendar @@ -46,27 +46,27 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d get :snippets get :exists get :activity - get '/', to: redirect('%{username}'), as: nil + get "/", to: redirect("%{username}"), as: nil end # Compatibility with old routing # TODO (dzaporozhets): remove in 10.0 - get '/u/:username', to: redirect('%{username}') + get "/u/:username", to: redirect("%{username}") # TODO (dzaporozhets): remove in 9.0 - get '/u/:username/groups', to: redirect('users/%{username}/groups') - get '/u/:username/projects', to: redirect('users/%{username}/projects') - get '/u/:username/snippets', to: redirect('users/%{username}/snippets') - get '/u/:username/contributed', to: redirect('users/%{username}/contributed') + get "/u/:username/groups", to: redirect("users/%{username}/groups") + get "/u/:username/projects", to: redirect("users/%{username}/projects") + get "/u/:username/snippets", to: redirect("users/%{username}/snippets") + get "/u/:username/contributed", to: redirect("users/%{username}/contributed") end constraints(::Constraints::UserUrlConstrainer.new) do # Get all keys of user - get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex } + get ":username.keys" => "profiles/keys#get_keys", :constraints => {username: Gitlab::PathRegex.root_namespace_route_regex} - scope(path: ':username', + scope(path: ":username", as: :user, - constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }, + constraints: {username: Gitlab::PathRegex.root_namespace_route_regex}, controller: :users) do - get '/', action: :show + get "/", action: :show end end |