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