Commit fa4150d4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cleanup after omniauth

parent 486de8c3
.auth_methods {
ul {
margin: 0;
text-align:center;
padding: 5px;
li {
display: inline;
}
}
}
......@@ -142,4 +142,8 @@
border:none;
}
}
.ui-box-body {
padding:10px;
}
}
......@@ -134,7 +134,6 @@ $hover: #fdf5d9;
* TODO: clean it
*/
@import "common.scss";
@import "auth_methods.scss";
/**
* Styles related to specific part of app
......
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
Gitlab.config.omniauth_providers.each do |provider|
define_method provider['name'] do
handle_omniauth
end
end
# Extend the standard message generation to accept our custom exception
def failure_message
......@@ -19,12 +24,6 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
sign_in_and_redirect @user
end
Settings.omniauth_providers.each do |provider|
define_method provider['name'] do
handle_omniauth
end
end
private
def handle_omniauth
......
......@@ -137,7 +137,8 @@ module ApplicationHelper
end
def authbutton(provider, size = 64)
image_tag("authbuttons/#{provider.to_s.split('_').first}_#{size}.png",
alt: "Sign in with #{provider.to_s.titleize}" )
file_name = "#{provider.to_s.split('_').first}_#{size}.png"
image_tag("authbuttons/#{file_name}",
alt: "Sign in with #{provider.to_s.titleize}")
end
end
......@@ -15,7 +15,8 @@
.right
= render :partial => "devise/shared/links"
- if devise_mapping.omniauthable?
- resource_class.omniauth_providers.each do |provider|
%hr/
= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary"
%br/
%ul.unstyled
- resource_class.omniauth_providers.each do |provider|
%li
= link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider)
......@@ -19,11 +19,11 @@
= f.label :password_confirmation
.input= f.password_field :password_confirmation
- if Settings.omniauth.enabled
- if Gitlab.config.omniauth_enabled?
.span5.right
.auth_methods.alert.alert-info
.alert.alert-info
%strong Tip: Use one of the following sites to login
%ul
%ul.unstyled
- User.omniauth_providers.each do |provider|
%li= link_to authbutton(provider), |
omniauth_authorize_path(User, provider) |
......
......@@ -50,13 +50,18 @@
%strong Tip:
You can change your avatar at gravatar.com
- if Settings.omniauth.enabled && @user.provider?
- @user.provider = 'twitter'
- if Gitlab.config.omniauth_enabled? && @user.provider?
.ui-box
.ui-box-body
%h4
Omniauth Providers:
= link_to "Change", profile_password_path, class: "btn small right"
You can login through #{@user.provider.titleize}!
= authbutton(@user.provider, 32)
.ui-box
.ui-box-body
%h4
Personal projects:
%small.right
......@@ -66,12 +71,13 @@
.progress
.bar{style: "width: #{current_user.projects_limit_percent}%;"}
.ui-box
.ui-box-body
%h4
SSH public keys:
%small.right
%span= link_to current_user.keys.count, keys_path
%strong.right= link_to current_user.keys.count, keys_path
= link_to "Add Public Key", new_key_path, class: "btn small right"
= link_to "Add Public Key", new_key_path, class: "btn small"
.form-actions
= f.submit 'Save', class: "btn save-btn"
......@@ -43,8 +43,6 @@ ldap:
omniauth:
enabled: false
allow_single_sign_on: false
block_auto_created_users: true
providers:
# - { name: 'google_oauth2', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
......@@ -53,6 +51,10 @@ omniauth:
# app_secret: 'YOUR APP SECRET'}
# - { name: 'github', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET' }
# IMPORTANT!
# It allows user to login without having user account
allow_single_sign_on: false
block_auto_created_users: true
#
......
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