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
dc37c8aa
Commit
dc37c8aa
authored
Sep 14, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored profile area
parent
8f9a450e
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
104 additions
and
68 deletions
+104
-68
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+7
-0
app/assets/stylesheets/main.scss
app/assets/stylesheets/main.scss
+5
-0
app/assets/stylesheets/sections/profile.scss
app/assets/stylesheets/sections/profile.scss
+8
-0
app/controllers/profile_controller.rb
app/controllers/profile_controller.rb
+6
-2
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+2
-1
app/views/layouts/profile.html.haml
app/views/layouts/profile.html.haml
+5
-5
app/views/profile/account.html.haml
app/views/profile/account.html.haml
+57
-0
app/views/profile/history.html.haml
app/views/profile/history.html.haml
+5
-0
app/views/profile/password.html.haml
app/views/profile/password.html.haml
+0
-29
app/views/profile/show.html.haml
app/views/profile/show.html.haml
+2
-2
app/views/profile/token.html.haml
app/views/profile/token.html.haml
+0
-23
config/routes.rb
config/routes.rb
+2
-1
features/profile/profile.feature
features/profile/profile.feature
+1
-1
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+2
-2
spec/requests/security/profile_access_spec.rb
spec/requests/security/profile_access_spec.rb
+2
-2
No files found.
app/assets/stylesheets/common.scss
View file @
dc37c8aa
...
@@ -699,7 +699,14 @@ li.note {
...
@@ -699,7 +699,14 @@ li.note {
.active
{
.active
{
img
{
img
{
border
:
1px
solid
#ccc
;
border
:
1px
solid
#ccc
;
background
:
$hover
;
@include
border-radius
(
5px
);
@include
border-radius
(
5px
);
}
}
}
}
}
}
.btn-build-token
{
float
:
left
;
padding
:
6px
20px
;
margin-right
:
12px
;
}
app/assets/stylesheets/main.scss
View file @
dc37c8aa
...
@@ -160,6 +160,11 @@ $hover: #fdf5d9;
...
@@ -160,6 +160,11 @@ $hover: #fdf5d9;
*/
*/
@import
"sections/notes.scss"
;
@import
"sections/notes.scss"
;
/**
* This file represent profile styles
*/
@import
"sections/profile.scss"
;
/**
/**
* Devise styles
* Devise styles
*/
*/
...
...
app/assets/stylesheets/sections/profile.scss
0 → 100644
View file @
dc37c8aa
.profile_history
{
.event_feed
{
min-height
:
20px
;
.avatar
{
width
:
20px
;
}
}
}
app/controllers/profile_controller.rb
View file @
dc37c8aa
...
@@ -32,10 +32,14 @@ class ProfileController < ApplicationController
...
@@ -32,10 +32,14 @@ class ProfileController < ApplicationController
def
reset_private_token
def
reset_private_token
current_user
.
reset_authentication_token!
current_user
.
reset_authentication_token!
redirect_to
profile_
token
_path
redirect_to
profile_
account
_path
end
end
private
def
history
@events
=
current_user
.
recent_events
.
page
(
params
[
:page
]).
per
(
20
)
end
private
def
user
def
user
@user
=
current_user
@user
=
current_user
...
...
app/helpers/application_helper.rb
View file @
dc37c8aa
...
@@ -104,7 +104,8 @@ module ApplicationHelper
...
@@ -104,7 +104,8 @@ module ApplicationHelper
# Profile Area
# Profile Area
when
:profile
;
current_page?
(
controller:
"profile"
,
action: :show
)
when
:profile
;
current_page?
(
controller:
"profile"
,
action: :show
)
when
:password
;
current_page?
(
controller:
"profile"
,
action: :password
)
when
:history
;
current_page?
(
controller:
"profile"
,
action: :history
)
when
:account
;
current_page?
(
controller:
"profile"
,
action: :account
)
when
:token
;
current_page?
(
controller:
"profile"
,
action: :token
)
when
:token
;
current_page?
(
controller:
"profile"
,
action: :token
)
when
:design
;
current_page?
(
controller:
"profile"
,
action: :design
)
when
:design
;
current_page?
(
controller:
"profile"
,
action: :design
)
when
:ssh_keys
;
controller
.
controller_name
==
"keys"
when
:ssh_keys
;
controller
.
controller_name
==
"keys"
...
...
app/views/layouts/profile.html.haml
View file @
dc37c8aa
...
@@ -9,20 +9,20 @@
...
@@ -9,20 +9,20 @@
%li
.home
{
class:
tab_class
(
:profile
)}
%li
.home
{
class:
tab_class
(
:profile
)}
=
link_to
"Profile"
,
profile_path
=
link_to
"Profile"
,
profile_path
%li
{
class:
tab_class
(
:
password
)}
%li
{
class:
tab_class
(
:
account
)}
=
link_to
"A
uthentication"
,
profile_password
_path
=
link_to
"A
ccount"
,
profile_account
_path
%li
{
class:
tab_class
(
:ssh_keys
)}
%li
{
class:
tab_class
(
:ssh_keys
)}
=
link_to
keys_path
do
=
link_to
keys_path
do
SSH Keys
SSH Keys
%span
.count
=
current_user
.
keys
.
count
%span
.count
=
current_user
.
keys
.
count
%li
{
class:
tab_class
(
:token
)}
=
link_to
"Token"
,
profile_token_path
%li
{
class:
tab_class
(
:design
)}
%li
{
class:
tab_class
(
:design
)}
=
link_to
"Design"
,
profile_design_path
=
link_to
"Design"
,
profile_design_path
%li
{
class:
tab_class
(
:history
)}
=
link_to
"History"
,
profile_history_path
.content
.content
=
yield
=
yield
app/views/profile/account.html.haml
0 → 100644
View file @
dc37c8aa
-
if
Gitlab
.
config
.
omniauth_enabled?
%fieldset
%legend
%h3
.page_title
Social Accounts
.oauth_select_holder
%p
.hint
Tip: Click on icon to activate sigin with one of the following services
-
User
.
omniauth_providers
.
each
do
|
provider
|
%span
{
class:
oauth_active_class
(
provider
)
}
=
link_to
authbutton
(
provider
,
32
),
omniauth_authorize_path
(
User
,
provider
)
%fieldset
%legend
%h3
.page_title
Private token
%span
.cred.right
keep it in secret!
.padded
=
form_for
@user
,
url:
profile_reset_private_token_path
,
method: :put
do
|
f
|
.data
%p
.slead
Private token used to access application resources without authentication.
%br
It can be used for atom feed or API
%p
.cgray
-
if
current_user
.
private_token
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"xxlarge large_text"
=
f
.
submit
'Reset'
,
confirm:
"Are you sure?"
,
class:
"btn primary btn-build-token"
-
else
%span
You don`t have one yet. Click generate to fix it.
=
f
.
submit
'Generate'
,
class:
"btn success btn-build-token"
%fieldset
%legend
%h3
.page_title
Password
=
form_for
@user
,
url:
profile_password_path
,
method: :put
do
|
f
|
.padded
%p
.slead
After successful password update you will be redirected to login page where you should login with new password
-
if
@user
.
errors
.
any?
.alert-message.block-message.error
%ul
-
@user
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.clearfix
=
f
.
label
:password
.input
=
f
.
password_field
:password
.clearfix
=
f
.
label
:password_confirmation
.input
=
f
.
password_field
:password_confirmation
.actions
=
f
.
submit
'Save'
,
class:
"btn save-btn"
app/views/profile/history.html.haml
0 → 100644
View file @
dc37c8aa
.profile_history
=
render
@events
%hr
=
paginate
@events
,
theme:
"gitlab"
app/views/profile/password.html.haml
deleted
100644 → 0
View file @
8f9a450e
-
if
Gitlab
.
config
.
omniauth_enabled?
%h3
.page_title
Accounts
%hr
%p
.hint
Tip: Click on icon to activate sigin with one of the following services
.oauth_select_holder
-
User
.
omniauth_providers
.
each
do
|
provider
|
%span
{
class:
oauth_active_class
(
provider
)
}
=
link_to
authbutton
(
provider
,
32
),
omniauth_authorize_path
(
User
,
provider
)
.clearfix.prepend-top-20
%h3
.page_title
Password
%hr
=
form_for
@user
,
url:
profile_password_path
,
method: :put
do
|
f
|
%p
.slead
After successful password update you will be redirected to login page where you should login with new password
-
if
@user
.
errors
.
any?
.alert-message.block-message.error
%ul
-
@user
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.clearfix
=
f
.
label
:password
.input
=
f
.
password_field
:password
.clearfix
=
f
.
label
:password_confirmation
.input
=
f
.
password_field
:password_confirmation
.actions
=
f
.
submit
'Save'
,
class:
"btn save-btn"
app/views/profile/show.html.haml
View file @
dc37c8aa
...
@@ -33,13 +33,13 @@
...
@@ -33,13 +33,13 @@
%ul
%ul
-
unless
Gitlab
.
config
.
disable_gravatar?
-
unless
Gitlab
.
config
.
disable_gravatar?
%li
%li
%p
.hint
You can change your avatar at
gravatar.com
%p
.hint
You can change your avatar at
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
-
if
Gitlab
.
config
.
omniauth_enabled?
&&
@user
.
provider?
-
if
Gitlab
.
config
.
omniauth_enabled?
&&
@user
.
provider?
%li
%li
%p
.hint
%p
.hint
You can login through
#{
@user
.
provider
.
titleize
}
!
You can login through
#{
@user
.
provider
.
titleize
}
!
=
link_to
"click here to change"
,
profile_
password
_path
=
link_to
"click here to change"
,
profile_
account
_path
%hr
%hr
.row
.row
...
...
app/views/profile/token.html.haml
deleted
100644 → 0
View file @
8f9a450e
%h3
.page_title
Private token
%span
.cred.right
keep it in secret!
%hr
=
form_for
@user
,
url:
profile_reset_private_token_path
,
method: :put
do
|
f
|
.data
%p
.slead
Private token used to access application resources without authentication.
%br
It can be used for atom feed or API
%p
.cgray
-
if
current_user
.
private_token
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"xxlarge large_text"
-
else
You don`t have one yet. Click generate to fix it.
.actions
-
if
current_user
.
private_token
=
f
.
submit
'Reset'
,
confirm:
"Are you sure?"
,
class:
"btn"
-
else
=
f
.
submit
'Generate'
,
class:
"btn primary"
config/routes.rb
View file @
dc37c8aa
...
@@ -63,7 +63,8 @@ Gitlab::Application.routes.draw do
...
@@ -63,7 +63,8 @@ Gitlab::Application.routes.draw do
#
#
# Profile Area
# Profile Area
#
#
get
"profile/password"
,
:to
=>
"profile#password"
get
"profile/account"
,
:to
=>
"profile#account"
get
"profile/history"
,
:to
=>
"profile#history"
put
"profile/password"
,
:to
=>
"profile#password_update"
put
"profile/password"
,
:to
=>
"profile#password_update"
get
"profile/token"
,
:to
=>
"profile#token"
get
"profile/token"
,
:to
=>
"profile#token"
put
"profile/reset_private_token"
,
:to
=>
"profile#reset_private_token"
put
"profile/reset_private_token"
,
:to
=>
"profile#reset_private_token"
...
...
features/profile/profile.feature
View file @
dc37c8aa
...
@@ -12,7 +12,7 @@ Feature: Profile
...
@@ -12,7 +12,7 @@ Feature: Profile
And
I should see new contact info
And
I should see new contact info
Scenario
:
I
change my password
Scenario
:
I
change my password
Given
I visit profile
password
page
Given
I visit profile
account
page
Then
I change my password
Then
I change my password
And
I should be redirected to sign in page
And
I should be redirected to sign in page
...
...
features/steps/shared/paths.rb
View file @
dc37c8aa
...
@@ -21,8 +21,8 @@ module SharedPaths
...
@@ -21,8 +21,8 @@ module SharedPaths
visit
profile_path
visit
profile_path
end
end
Given
'I visit profile
password
page'
do
Given
'I visit profile
account
page'
do
visit
profile_
password
_path
visit
profile_
account
_path
end
end
Given
'I visit profile token page'
do
Given
'I visit profile token page'
do
...
...
spec/requests/security/profile_access_spec.rb
View file @
dc37c8aa
...
@@ -28,8 +28,8 @@ describe "Users Security" do
...
@@ -28,8 +28,8 @@ describe "Users Security" do
it
{
should
be_denied_for
:visitor
}
it
{
should
be_denied_for
:visitor
}
end
end
describe
"GET /profile/
password
"
do
describe
"GET /profile/
account
"
do
subject
{
profile_
password
_path
}
subject
{
profile_
account
_path
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
@u1
}
it
{
should
be_allowed_for
:admin
}
it
{
should
be_allowed_for
:admin
}
...
...
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