Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
777c119f
Commit
777c119f
authored
Mar 21, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restyle oauth accounts at profile page and add ability to unlink account
parent
9f1c2844
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
59 additions
and
54 deletions
+59
-54
CHANGELOG
CHANGELOG
+2
-0
app/assets/stylesheets/generic/forms.scss
app/assets/stylesheets/generic/forms.scss
+0
-4
app/assets/stylesheets/pages/login.scss
app/assets/stylesheets/pages/login.scss
+9
-0
app/assets/stylesheets/pages/profile.scss
app/assets/stylesheets/pages/profile.scss
+16
-24
app/controllers/profiles/accounts_controller.rb
app/controllers/profiles/accounts_controller.rb
+6
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-6
app/helpers/oauth_helper.rb
app/helpers/oauth_helper.rb
+10
-1
app/helpers/profile_helper.rb
app/helpers/profile_helper.rb
+0
-6
app/views/devise/shared/_omniauth_box.html.haml
app/views/devise/shared/_omniauth_box.html.haml
+1
-1
app/views/profiles/accounts/show.html.haml
app/views/profiles/accounts/show.html.haml
+10
-11
config/routes.rb
config/routes.rb
+5
-1
No files found.
CHANGELOG
View file @
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)
...
...
app/assets/stylesheets/generic/forms.scss
View file @
777c119f
...
@@ -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
;
...
...
app/assets/stylesheets/pages/login.scss
View file @
777c119f
...
@@ -113,3 +113,12 @@
...
@@ -113,3 +113,12 @@
}
}
}
}
}
}
.oauth-image-link
{
margin-right
:
10px
;
img
{
width
:
32px
;
height
:
32px
;
}
}
app/assets/stylesheets/pages/profile.scss
View file @
777c119f
.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
;
}
}
}
app/controllers/profiles/accounts_controller.rb
View file @
777c119f
...
@@ -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
app/helpers/application_helper.rb
View file @
777c119f
...
@@ -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
...
...
app/helpers/oauth_helper.rb
View file @
777c119f
...
@@ -21,5 +21,14 @@ module OauthHelper
...
@@ -21,5 +21,14 @@ module OauthHelper
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
app/helpers/profile_helper.rb
View file @
777c119f
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
...
...
app/views/devise/shared/_omniauth_box.html.haml
View file @
777c119f
...
@@ -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"
app/views/profiles/accounts/show.html.haml
View file @
777c119f
%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
...
...
config/routes.rb
View file @
777c119f
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment