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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
f2a9455c
Commit
f2a9455c
authored
Mar 04, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ssh-key-settings' into 'master'
SSH keys settings Closes #13860 See merge request !3034
parents
77c7b561
518dd934
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
112 additions
and
78 deletions
+112
-78
app/assets/javascripts/profile.js.coffee
app/assets/javascripts/profile.js.coffee
+9
-0
app/assets/stylesheets/framework/buttons.scss
app/assets/stylesheets/framework/buttons.scss
+13
-0
app/assets/stylesheets/framework/lists.scss
app/assets/stylesheets/framework/lists.scss
+1
-0
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+5
-0
app/assets/stylesheets/pages/profile.scss
app/assets/stylesheets/pages/profile.scss
+30
-0
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+3
-5
app/views/admin/users/keys.html.haml
app/views/admin/users/keys.html.haml
+1
-1
app/views/profiles/keys/_form.html.haml
app/views/profiles/keys/_form.html.haml
+6
-8
app/views/profiles/keys/_key.html.haml
app/views/profiles/keys/_key.html.haml
+14
-11
app/views/profiles/keys/_key_details.html.haml
app/views/profiles/keys/_key_details.html.haml
+1
-1
app/views/profiles/keys/_key_table.html.haml
app/views/profiles/keys/_key_table.html.haml
+6
-14
app/views/profiles/keys/index.html.haml
app/views/profiles/keys/index.html.haml
+18
-11
app/views/profiles/keys/new.html.haml
app/views/profiles/keys/new.html.haml
+0
-17
app/views/shared/_no_ssh.html.haml
app/views/shared/_no_ssh.html.haml
+1
-1
config/routes.rb
config/routes.rb
+1
-1
features/profile/ssh_keys.feature
features/profile/ssh_keys.feature
+1
-1
features/steps/profile/ssh_keys.rb
features/steps/profile/ssh_keys.rb
+2
-2
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+0
-5
No files found.
app/assets/javascripts/profile.js.coffee
View file @
f2a9455c
...
@@ -62,3 +62,12 @@ class @Profile
...
@@ -62,3 +62,12 @@ class @Profile
$modalCropImg
.
attr
(
'src'
,
event
.
target
.
result
)
$modalCropImg
.
attr
(
'src'
,
event
.
target
.
result
)
fileData
=
reader
.
readAsDataURL
(
this
.
files
[
0
])
fileData
=
reader
.
readAsDataURL
(
this
.
files
[
0
])
$
->
# Extract the SSH Key title from its comment
$
(
document
).
on
'focusout.ssh_key'
,
'#key_key'
,
->
$title
=
$
(
'#key_title'
)
comment
=
$
(
@
).
val
().
match
(
/^\S+ \S+ (.+)\n?$/
)
if
comment
&&
comment
.
length
>
1
&&
$title
.
val
()
==
''
$title
.
val
(
comment
[
1
]).
change
()
app/assets/stylesheets/framework/buttons.scss
View file @
f2a9455c
...
@@ -143,6 +143,19 @@
...
@@ -143,6 +143,19 @@
}
}
}
}
.btn-transparent
{
color
:
$btn-transparent-color
;
background-color
:
transparent
;
border
:
0
;
&
:hover
,
&
:active
,
&
:focus
{
background-color
:
transparent
;
box-shadow
:
none
;
}
}
.btn-block
{
.btn-block
{
width
:
100%
;
width
:
100%
;
margin
:
0
;
margin
:
0
;
...
...
app/assets/stylesheets/framework/lists.scss
View file @
f2a9455c
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
*
*
*/
*/
.well-list
{
.well-list
{
position
:
relative
;
margin
:
0
;
margin
:
0
;
padding
:
0
;
padding
:
0
;
list-style
:
none
;
list-style
:
none
;
...
...
app/assets/stylesheets/framework/variables.scss
View file @
f2a9455c
...
@@ -36,6 +36,11 @@ $list-title-color: #333333;
...
@@ -36,6 +36,11 @@ $list-title-color: #333333;
$list-text-color
:
#555555
;
$list-text-color
:
#555555
;
$profile-settings-link-color
:
$md-link-color
;
$profile-settings-link-color
:
$md-link-color
;
$btn-transparent-color
:
#8F8F8F
;
$ssh-key-icon-color
:
#8F8F8F
;
$ssh-key-icon-size
:
18px
;
/*
/*
* Color schema
* Color schema
*/
*/
...
...
app/assets/stylesheets/pages/profile.scss
View file @
f2a9455c
...
@@ -145,3 +145,33 @@
...
@@ -145,3 +145,33 @@
width
:
auto
;
width
:
auto
;
}
}
}
}
.key-list-item
{
.key-list-item-info
{
@media
(
min-width
:
$screen-sm-min
)
{
float
:
left
;
}
}
.description
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
}
.key-icon
{
color
:
$ssh-key-icon-color
;
font-size
:
$ssh-key-icon-size
;
line-height
:
42px
;
}
.key-created-at
{
line-height
:
42px
;
}
.profile-settings-content
{
a
{
color
:
$profile-settings-link-color
;
}
}
app/controllers/profiles/keys_controller.rb
View file @
f2a9455c
...
@@ -3,23 +3,21 @@ class Profiles::KeysController < Profiles::ApplicationController
...
@@ -3,23 +3,21 @@ class Profiles::KeysController < Profiles::ApplicationController
def
index
def
index
@keys
=
current_user
.
keys
@keys
=
current_user
.
keys
@key
=
Key
.
new
end
end
def
show
def
show
@key
=
current_user
.
keys
.
find
(
params
[
:id
])
@key
=
current_user
.
keys
.
find
(
params
[
:id
])
end
end
def
new
@key
=
current_user
.
keys
.
new
end
def
create
def
create
@key
=
current_user
.
keys
.
new
(
key_params
)
@key
=
current_user
.
keys
.
new
(
key_params
)
if
@key
.
save
if
@key
.
save
redirect_to
profile_key_path
(
@key
)
redirect_to
profile_key_path
(
@key
)
else
else
render
'new'
@keys
=
current_user
.
keys
.
select
(
&
:persisted?
)
render
:index
end
end
end
end
...
...
app/views/admin/users/keys.html.haml
View file @
f2a9455c
-
page_title
"Keys"
,
@user
.
name
,
"Users"
-
page_title
"
SSH
Keys"
,
@user
.
name
,
"Users"
=
render
'admin/users/head'
=
render
'admin/users/head'
=
render
'profiles/keys/key_table'
,
admin:
true
=
render
'profiles/keys/key_table'
,
admin:
true
app/views/profiles/keys/_form.html.haml
View file @
f2a9455c
%div
%div
=
form_for
[
:profile
,
@key
],
html:
{
class:
'
form-horizontal
js-requires-input'
}
do
|
f
|
=
form_for
[
:profile
,
@key
],
html:
{
class:
'js-requires-input'
}
do
|
f
|
-
if
@key
.
errors
.
any?
-
if
@key
.
errors
.
any?
.alert.alert-danger
.alert.alert-danger
%ul
%ul
...
@@ -7,13 +7,11 @@
...
@@ -7,13 +7,11 @@
%li
=
msg
%li
=
msg
.form-group
.form-group
=
f
.
label
:key
,
class:
'control-label'
=
f
.
label
:key
,
class:
'label-light'
.col-sm-10
=
f
.
text_area
:key
,
class:
"form-control"
,
rows:
8
,
required:
true
=
f
.
text_area
:key
,
class:
"form-control"
,
rows:
8
,
autofocus:
true
,
required:
true
.form-group
.form-group
=
f
.
label
:title
,
class:
'
control-label
'
=
f
.
label
:title
,
class:
'
label-light
'
.col-sm-10
=
f
.
text_field
:title
,
class:
"form-control"
,
required:
true
=
f
.
text_field
:title
,
class:
"form-control"
,
required:
true
.
form-actions
.
prepend-top-default
=
f
.
submit
'Add key'
,
class:
"btn btn-create"
=
f
.
submit
'Add key'
,
class:
"btn btn-create"
=
link_to
"Cancel"
,
profile_keys_path
,
class:
"btn btn-cancel"
app/views/profiles/keys/_key.html.haml
View file @
f2a9455c
%tr
%li
.key-list-item
%td
.pull-left.append-right-10
=
link_to
path_to_key
(
key
,
is_admin
)
do
=
icon
'key'
,
class:
"key-icon hidden-xs"
%strong
=
key
.
title
.key-list-item-info
%td
=
link_to
path_to_key
(
key
,
is_admin
),
class:
"title"
do
%code
.key-fingerprint
=
key
.
fingerprint
=
key
.
title
%td
.description
%span
.cgray
=
key
.
fingerprint
added
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
.pull-right
%td
%span
.key-created-at
=
link_to
'Remove'
,
path_to_key
(
key
,
is_admin
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-sm btn-remove delete-key pull-right"
created
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
ago
=
link_to
path_to_key
(
key
,
is_admin
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-transparent prepend-left-10"
do
%span
.sr-only
Remove
=
icon
(
'trash'
)
app/views/profiles/keys/_key_details.html.haml
View file @
f2a9455c
-
is_admin
=
defined?
(
admin
)
?
true
:
false
-
is_admin
=
defined?
(
admin
)
?
true
:
false
.row
.row
.prepend-top-default
.col-md-4
.col-md-4
.panel.panel-default
.panel.panel-default
.panel-heading
.panel-heading
...
...
app/views/profiles/keys/_key_table.html.haml
View file @
f2a9455c
-
is_admin
=
defined?
(
admin
)
?
true
:
false
-
is_admin
=
local_assigns
.
fetch
(
:admin
,
false
)
-
if
@keys
.
any?
-
if
@keys
.
any?
.table-holder
%ul
.well-list
%table
.table
=
render
partial:
'profiles/keys/key'
,
collection:
@keys
,
locals:
{
is_admin:
is_admin
}
%thead
.panel-heading
%tr
%th
Title
%th
Fingerprint
%th
Added at
%th
%tbody
-
@keys
.
each
do
|
key
|
=
render
'profiles/keys/key'
,
key:
key
,
is_admin:
is_admin
-
else
-
else
.nothing-here-block
%p
.profile-settings-message.text-center
-
if
is_admin
-
if
is_admin
User has no ssh keys
There are no SSH keys associated with this account.
-
else
-
else
There are no SSH keys with access to your account.
There are no SSH keys with access to your account.
app/views/profiles/keys/index.html.haml
View file @
f2a9455c
-
page_title
"SSH Keys"
-
page_title
"SSH Keys"
-
header_title
page_title
,
profile_keys_path
-
header_title
page_title
,
profile_keys_path
.top-area
.row.prepend-top-default
.nav-text
.col-lg-3.profile-settings-sidebar
Before you can add an SSH key you need to
%h4
.prepend-top-0
=
link_to
"generate it."
,
help_page_path
(
"ssh"
,
"README"
)
=
page_title
.nav-controls
%p
=
link_to
new_profile_key_path
,
class:
"btn btn-new"
do
SSH keys allow you to establish a secure connection between your computer and GitLab.
=
icon
(
'plus'
)
.col-lg-9
Add SSH Key
%h5
.prepend-top-0
Add an SSH key
.prepend-top-default
%p
.profile-settings-content
=
render
'key_table'
Before you can add an SSH key you need to
=
link_to
"generate it."
,
help_page_path
(
"ssh"
,
"README"
)
=
render
'form'
%hr
%h5
Your SSH keys (
#{
@keys
.
count
}
)
%div
.append-bottom-default
=
render
'key_table'
app/views/profiles/keys/new.html.haml
deleted
100644 → 0
View file @
77c7b561
-
page_title
"Add SSH Keys"
%h3
.page-title
Add an SSH Key
%p
.light
Paste your public key here. Read more about how to generate a key on
#{
link_to
"the SSH help page"
,
help_page_path
(
"ssh"
,
"README"
)
}
.
%hr
=
render
'form'
:javascript
$
(
'
#key_key
'
).
on
(
'
focusout
'
,
function
(){
var
title
=
$
(
'
#key_title
'
),
val
=
$
(
'
#key_key
'
).
val
(),
comment
=
val
.
match
(
/^
\S
+
\S
+
(
.+
)\n?
$/
);
if
(
comment
&&
comment
.
length
>
1
&&
title
.
val
()
==
''
){
$
(
'
#key_title
'
).
val
(
comment
[
1
]
).
change
();
}
});
app/views/shared/_no_ssh.html.haml
View file @
f2a9455c
-
if
cookies
[
:hide_no_ssh_message
].
blank?
&&
!
current_user
.
hide_no_ssh_key
&&
current_user
.
require_ssh_key?
-
if
cookies
[
:hide_no_ssh_message
].
blank?
&&
!
current_user
.
hide_no_ssh_key
&&
current_user
.
require_ssh_key?
.no-ssh-key-message.alert.alert-warning.hidden-xs
.no-ssh-key-message.alert.alert-warning.hidden-xs
You won't be able to pull or push project code via SSH until you
#{
link_to
'add an SSH key'
,
new_profile_key
_path
,
class:
'alert-link'
}
to your profile
You won't be able to pull or push project code via SSH until you
#{
link_to
'add an SSH key'
,
profile_keys
_path
,
class:
'alert-link'
}
to your profile
.pull-right
.pull-right
=
link_to
"Don't show again"
,
profile_path
(
user:
{
hide_no_ssh_key:
true
}),
method: :put
,
class:
'alert-link'
=
link_to
"Don't show again"
,
profile_path
(
user:
{
hide_no_ssh_key:
true
}),
method: :put
,
class:
'alert-link'
...
...
config/routes.rb
View file @
f2a9455c
...
@@ -314,7 +314,7 @@ Rails.application.routes.draw do
...
@@ -314,7 +314,7 @@ Rails.application.routes.draw do
end
end
end
end
resource
:preferences
,
only:
[
:show
,
:update
]
resource
:preferences
,
only:
[
:show
,
:update
]
resources
:keys
resources
:keys
,
except:
[
:new
]
resources
:emails
,
only:
[
:index
,
:create
,
:destroy
]
resources
:emails
,
only:
[
:index
,
:create
,
:destroy
]
resource
:avatar
,
only:
[
:destroy
]
resource
:avatar
,
only:
[
:destroy
]
resource
:two_factor_auth
,
only:
[
:new
,
:create
,
:destroy
]
do
resource
:two_factor_auth
,
only:
[
:new
,
:create
,
:destroy
]
do
...
...
features/profile/ssh_keys.feature
View file @
f2a9455c
...
@@ -9,7 +9,7 @@ Feature: Profile SSH Keys
...
@@ -9,7 +9,7 @@ Feature: Profile SSH Keys
Then
I should see my ssh keys
Then
I should see my ssh keys
Scenario
:
Add new ssh key
Scenario
:
Add new ssh key
Given
I
click link
"Add new"
Given
I
should see new ssh key form
And
I submit new ssh key
"Laptop"
And
I submit new ssh key
"Laptop"
Then
I should see new ssh key
"Laptop"
Then
I should see new ssh key
"Laptop"
...
...
features/steps/profile/ssh_keys.rb
View file @
f2a9455c
...
@@ -7,8 +7,8 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
...
@@ -7,8 +7,8 @@ class Spinach::Features::ProfileSshKeys < Spinach::FeatureSteps
end
end
end
end
step
'I
click link "Add new"
'
do
step
'I
should see new ssh key form
'
do
click_link
"Add SSH Key"
expect
(
page
).
to
have_content
(
"Add an SSH key"
)
end
end
step
'I submit new ssh key "Laptop"'
do
step
'I submit new ssh key "Laptop"'
do
...
...
spec/routing/routing_spec.rb
View file @
f2a9455c
...
@@ -137,7 +137,6 @@ end
...
@@ -137,7 +137,6 @@ end
# keys GET /keys(.:format) keys#index
# keys GET /keys(.:format) keys#index
# POST /keys(.:format) keys#create
# POST /keys(.:format) keys#create
# new_key GET /keys/new(.:format) keys#new
# edit_key GET /keys/:id/edit(.:format) keys#edit
# edit_key GET /keys/:id/edit(.:format) keys#edit
# key GET /keys/:id(.:format) keys#show
# key GET /keys/:id(.:format) keys#show
# PUT /keys/:id(.:format) keys#update
# PUT /keys/:id(.:format) keys#update
...
@@ -151,10 +150,6 @@ describe Profiles::KeysController, "routing" do
...
@@ -151,10 +150,6 @@ describe Profiles::KeysController, "routing" do
expect
(
post
(
"/profile/keys"
)).
to
route_to
(
'profiles/keys#create'
)
expect
(
post
(
"/profile/keys"
)).
to
route_to
(
'profiles/keys#create'
)
end
end
it
"to #new"
do
expect
(
get
(
"/profile/keys/new"
)).
to
route_to
(
'profiles/keys#new'
)
end
it
"to #edit"
do
it
"to #edit"
do
expect
(
get
(
"/profile/keys/1/edit"
)).
to
route_to
(
'profiles/keys#edit'
,
id:
'1'
)
expect
(
get
(
"/profile/keys/1/edit"
)).
to
route_to
(
'profiles/keys#edit'
,
id:
'1'
)
end
end
...
...
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