Commit 29f6b01d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'improve-profile' into 'master'

Improve profile

### OLD

![old-oauth](https://gitlab.com/gitlab-org/gitlab-ce/uploads/86f4b19d4e4cc9cf2705400428541a82/old-oauth.png)

### NEW

![profile](https://gitlab.com/gitlab-org/gitlab-ce/uploads/c480372e66af579ce355d5c215669296/profile.png)

See merge request !418
parents aadd38db 777c119f
...@@ -21,6 +21,8 @@ v 7.10.0 (unreleased) ...@@ -21,6 +21,8 @@ v 7.10.0 (unreleased)
- Improve GitLab performance when working with git repositories - Improve GitLab performance when working with git repositories
- Add tag message and last commit to tag hook (Kamil Trzciński) - Add tag message and last commit to tag hook (Kamil Trzciński)
- Restrict permissions on backup files - Restrict permissions on backup files
- Improve oauth accounts UI in profile page
- Add ability to unlink connected accounts
v 7.9.0 (unreleased) v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu) - Add HipChat integration documentation (Stan Hu)
......
...@@ -15,10 +15,6 @@ input[type='text'].danger { ...@@ -15,10 +15,6 @@ input[type='text'].danger {
text-shadow: 0 1px 1px #fff text-shadow: 0 1px 1px #fff
} }
fieldset legend {
font-size: 16px;
}
.datetime-controls { .datetime-controls {
select { select {
width: 100px; width: 100px;
......
...@@ -113,3 +113,12 @@ ...@@ -113,3 +113,12 @@
} }
} }
} }
.oauth-image-link {
margin-right: 10px;
img {
width: 32px;
height: 32px;
}
}
.account-page { .account-page {
fieldset { fieldset {
margin-bottom: 15px; margin-bottom: 15px;
border-bottom: 1px dashed #ddd;
padding-bottom: 15px; padding-bottom: 15px;
&:last-child {
border: none;
}
legend {
border: none;
margin-bottom: 10px;
}
}
}
.oauth_select_holder {
img {
padding: 2px;
margin-right: 10px;
}
.active {
img {
border: 1px solid #4BD;
background: $hover;
@include border-radius(5px);
}
} }
} }
...@@ -101,3 +77,19 @@ ...@@ -101,3 +77,19 @@
} }
} }
} }
.oauth-buttons {
.btn-group {
margin-right: 10px;
}
.btn {
line-height: 36px;
height: 56px;
img {
width: 32px;
height: 32px;
}
}
}
...@@ -4,4 +4,10 @@ class Profiles::AccountsController < ApplicationController ...@@ -4,4 +4,10 @@ class Profiles::AccountsController < ApplicationController
def show def show
@user = current_user @user = current_user
end end
def unlink
provider = params[:provider]
current_user.identities.find_by(provider: provider).destroy
redirect_to profile_account_path
end
end end
...@@ -174,16 +174,10 @@ module ApplicationHelper ...@@ -174,16 +174,10 @@ module ApplicationHelper
Digest::SHA1.hexdigest string Digest::SHA1.hexdigest string
end end
def authbutton(provider, size = 64)
file_name = "#{provider.to_s.split('_').first}_#{size}.png"
image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}")
end
def simple_sanitize(str) def simple_sanitize(str)
sanitize(str, tags: %w(a span)) sanitize(str, tags: %w(a span))
end end
def body_data_page def body_data_page
path = controller.controller_path.split('/') path = controller.controller_path.split('/')
namespace = path.first if path.second namespace = path.first if path.second
......
...@@ -20,6 +20,15 @@ module OauthHelper ...@@ -20,6 +20,15 @@ module OauthHelper
def additional_providers def additional_providers
enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')} enabled_oauth_providers.reject{|provider| provider.to_s.starts_with?('ldap')}
end end
def oauth_image_tag(provider, size = 64)
file_name = "#{provider.to_s.split('_').first}_#{size}.png"
image_tag(image_path("authbuttons/#{file_name}"), alt: "Sign in with #{provider.to_s.titleize}")
end
def oauth_active?(provider)
current_user.identities.exists?(provider: provider.to_s)
end
extend self extend self
end end
module ProfileHelper module ProfileHelper
def oauth_active_class(provider)
if current_user.identities.exists?(provider: provider.to_s)
'active'
end
end
def show_profile_username_tab? def show_profile_username_tab?
current_user.can_change_username? current_user.can_change_username?
end end
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
- providers.each do |provider| - providers.each do |provider|
%span.light %span.light
- if default_providers.include?(provider) - if default_providers.include?(provider)
= link_to authbutton(provider, 32), omniauth_authorize_path(resource_name, provider) = link_to oauth_image_tag(provider), omniauth_authorize_path(resource_name, provider), class: 'oauth-image-link'
- else - else
= link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn" = link_to provider.to_s.titleize, omniauth_authorize_path(resource_name, provider), class: "btn"
%h3.page-title - if current_user.ldap_user?
Account Settings .alert.alert-info
%p.light
You can change your username and private token here.
- if current_user.ldap_user?
Some options are unavailable for LDAP accounts Some options are unavailable for LDAP accounts
%hr
.account-page .account-page
%fieldset.update-token %fieldset.update-token
...@@ -33,12 +28,16 @@ ...@@ -33,12 +28,16 @@
- if show_profile_social_tab? - if show_profile_social_tab?
%fieldset %fieldset
%legend Social Accounts %legend Connected Accounts
.oauth_select_holder.append-bottom-10 .oauth-buttons.append-bottom-10
%p Click on icon to activate signin with one of the following services %p Click on icon to activate signin with one of the following services
- enabled_social_providers.each do |provider| - enabled_social_providers.each do |provider|
%span{class: oauth_active_class(provider) } .btn-group
= link_to authbutton(provider, 32), omniauth_authorize_path(User, provider) = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider),
class: "btn btn-lg #{'active' if oauth_active?(provider)}"
- if oauth_active?(provider)
= link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
%i.fa.fa-close
- if show_profile_username_tab? - if show_profile_username_tab?
%fieldset.update-username %fieldset.update-username
......
...@@ -184,7 +184,11 @@ Gitlab::Application.routes.draw do ...@@ -184,7 +184,11 @@ Gitlab::Application.routes.draw do
end end
scope module: :profiles do scope module: :profiles do
resource :account, only: [:show, :update] resource :account, only: [:show, :update] do
member do
delete :unlink
end
end
resource :notifications, only: [:show, :update] resource :notifications, only: [:show, :update]
resource :password, only: [:new, :create, :edit, :update] do resource :password, only: [:new, :create, :edit, :update] do
member do member do
......
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