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
ffec158d
Commit
ffec158d
authored
Oct 09, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restyle Profile#Account page
parent
4c8224ae
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
176 deletions
+81
-176
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+0
-1
app/controllers/profiles_controller.rb
app/controllers/profiles_controller.rb
+1
-30
app/views/layouts/nav/_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+5
-2
app/views/profiles/account.html.haml
app/views/profiles/account.html.haml
+0
-141
app/views/profiles/accounts/show.html.haml
app/views/profiles/accounts/show.html.haml
+73
-0
app/views/profiles/update_username.js.haml
app/views/profiles/update_username.js.haml
+2
-2
No files found.
app/assets/stylesheets/common.scss
View file @
ffec158d
...
...
@@ -271,7 +271,6 @@ li.note {
}
.oauth_select_holder
{
padding
:
20px
;
img
{
padding
:
5px
;
margin-right
:
10px
;
...
...
app/controllers/profiles_controller.rb
View file @
ffec158d
...
...
@@ -2,7 +2,6 @@ class ProfilesController < ApplicationController
include
ActionView
::
Helpers
::
SanitizeHelper
before_filter
:user
before_filter
:authorize_change_password!
,
only: :update_password
before_filter
:authorize_change_username!
,
only: :update_username
layout
'profile'
...
...
@@ -13,9 +12,6 @@ class ProfilesController < ApplicationController
def
design
end
def
account
end
def
update
if
@user
.
update_attributes
(
params
[
:user
])
flash
[
:notice
]
=
"Profile was successfully updated"
...
...
@@ -29,33 +25,12 @@ class ProfilesController < ApplicationController
end
end
def
token
end
def
update_password
password_attributes
=
params
[
:user
].
select
do
|
key
,
value
|
%w(password password_confirmation)
.
include?
(
key
.
to_s
)
end
unless
@user
.
valid_password?
(
params
[
:user
][
:current_password
])
redirect_to
account_profile_path
,
alert:
'You must provide a valid current password'
return
end
if
@user
.
update_attributes
(
password_attributes
)
flash
[
:notice
]
=
"Password was successfully updated. Please login with it"
redirect_to
new_user_session_path
else
render
'account'
end
end
def
reset_private_token
if
current_user
.
reset_authentication_token!
flash
[
:notice
]
=
"Token was successfully updated"
end
redirect_to
account_profile
_path
redirect_to
profile_account
_path
end
def
history
...
...
@@ -76,10 +51,6 @@ class ProfilesController < ApplicationController
@user
=
current_user
end
def
authorize_change_password!
return
render_404
if
@user
.
ldap_user?
end
def
authorize_change_username!
return
render_404
unless
@user
.
can_change_username?
end
...
...
app/views/layouts/nav/_profile.html.haml
View file @
ffec158d
...
...
@@ -2,8 +2,11 @@
=
nav_link
(
path:
'profiles#show'
,
html_options:
{
class:
'home'
})
do
=
link_to
profile_path
,
title:
"Profile"
do
%i
.icon-home
=
nav_link
(
path:
'profiles#account'
)
do
=
link_to
"Account"
,
account_profile_path
=
nav_link
(
controller: :accounts
)
do
=
link_to
"Account"
,
profile_account_path
-
unless
current_user
.
ldap_user?
=
nav_link
(
controller: :passwords
)
do
=
link_to
"Password"
,
edit_profile_password_path
=
nav_link
(
controller: :notifications
)
do
=
link_to
"Notifications"
,
profile_notifications_path
=
nav_link
(
controller: :keys
)
do
...
...
app/views/profiles/account.html.haml
deleted
100644 → 0
View file @
4c8224ae
%h3
.page-title
Account settings
%p
.light
You can change your password, username and private token here.
-
if
current_user
.
ldap_user?
Some options are unavailable for LDAP accounts
%hr
.row
.span2
%ul
.nav.nav-pills.nav-stacked.nav-stacked-menu
%li
.active
=
link_to
'#tab-token'
,
'data-toggle'
=>
'tab'
do
Private Token
%li
=
link_to
'#tab-password'
,
'data-toggle'
=>
'tab'
do
Password
-
if
show_profile_social_tab?
%li
=
link_to
'#tab-social'
,
'data-toggle'
=>
'tab'
do
Social Accounts
-
if
show_profile_username_tab?
%li
=
link_to
'#tab-username'
,
'data-toggle'
=>
'tab'
do
Change Username
-
if
show_profile_remove_tab?
%li
=
link_to
'#tab-remove'
,
'data-toggle'
=>
'tab'
do
Remove Account
.span10
.tab-content
.tab-pane.active
#tab-token
%fieldset
.update-token
%legend
Private token
%span
.cred.pull-right
keep it secret!
%div
=
form_for
@user
,
url:
reset_private_token_profile_path
,
method: :put
do
|
f
|
.data
%p
.slead
Your private token is used to access application resources without authentication.
%br
It can be used for atom feeds or the API.
%p
.cgray
-
if
current_user
.
private_token
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"input-xxlarge large_text input-xpadding"
=
f
.
submit
'Reset'
,
confirm:
"Are you sure?"
,
class:
"btn 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"
.tab-pane
#tab-password
%fieldset
.update-password
%legend
Password
-
if
current_user
.
ldap_user?
%h3
.nothing_here_message
Not available for LDAP user
-
else
=
form_for
@user
,
url:
update_password_profile_path
,
method: :put
do
|
f
|
%div
%p
.slead
You must provide current password in order to change it.
%br
After a successful password update you will be redirected to login page where you should login with your new password
-
if
@user
.
errors
.
any?
.alert.alert-error
%ul
-
@user
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
.control-group
=
f
.
label
:current_password
,
class:
'cgreen'
.controls
=
f
.
password_field
:current_password
,
required:
true
.control-group
=
f
.
label
:password
,
'New password'
.controls
=
f
.
password_field
:password
,
required:
true
.control-group
=
f
.
label
:password_confirmation
.controls
=
f
.
password_field
:password_confirmation
,
required:
true
.control-group
.controls
=
f
.
submit
'Save password'
,
class:
"btn btn-save"
-
if
show_profile_social_tab?
.tab-pane
#tab-social
%fieldset
%legend
Social Accounts
.oauth_select_holder
%p
.hint
Tip: Click on icon to activate signin with one of the following services
-
enabled_social_providers
.
each
do
|
provider
|
%span
{
class:
oauth_active_class
(
provider
)
}
=
link_to
authbutton
(
provider
,
32
),
omniauth_authorize_path
(
User
,
provider
)
-
if
show_profile_username_tab?
.tab-pane
#tab-username
%fieldset
.update-username
%legend
Username
%small
.cred.pull-right
Changing your username can have unintended side effects!
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
remote:
true
do
|
f
|
%div
.control-group
=
f
.
label
:username
.controls
=
f
.
text_field
:username
,
required:
true
%span
.loading-gif.hide
=
image_tag
"ajax_loader.gif"
%span
.update-success.cgreen.hide
%i
.icon-ok
Saved
%span
.update-failed.cred.hide
%i
.icon-remove
Failed
%ul
.cred
%li
This will change the web URL for personal projects.
%li
This will change the git path to repositories for personal projects.
.controls
=
f
.
submit
'Save username'
,
class:
"btn btn-save"
-
if
show_profile_remove_tab?
.tab-pane
#tab-remove
%fieldset
.remove-account
%legend
Remove account
%div
%p
Deleting an account has the following effects:
%ul
%li
All user content like authored issues, snippets, comments will be removed
-
rp
=
current_user
.
personal_projects
.
count
-
unless
rp
.
zero?
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
-
if
current_user
.
solo_owned_groups
.
present?
%li
Next groups will be abandoned. You should transfer or remove them:
%strong
#{
current_user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
=
link_to
'Delete account'
,
user_registration_path
,
confirm:
"REMOVE
#{
current_user
.
name
}
? Are you sure?"
,
method: :delete
,
class:
"btn btn-remove"
app/views/profiles/accounts/show.html.haml
0 → 100644
View file @
ffec158d
%h3
.page-title
Account settings
%p
.light
You can change your username and private token here.
-
if
current_user
.
ldap_user?
Some options are unavailable for LDAP accounts
%hr
%div
%fieldset
.update-token
%legend
Private token
%div
=
form_for
@user
,
url:
reset_private_token_profile_path
,
method: :put
do
|
f
|
.data
%p
Your private token is used to access application resources without authentication.
%br
It can be used for atom feeds or the API.
%span
.cred
Keep it secret!
%p
.cgray
-
if
current_user
.
private_token
=
text_field_tag
"token"
,
current_user
.
private_token
,
class:
"input-xlarge input-xpadding pull-left"
=
f
.
submit
'Reset'
,
confirm:
"Are you sure?"
,
class:
"btn btn-primary btn-build-token prepend-left-10"
-
else
%span
You don`t have one yet. Click generate to fix it.
=
f
.
submit
'Generate'
,
class:
"btn success btn-build-token"
-
if
show_profile_social_tab?
%fieldset
%legend
Social Accounts
.oauth_select_holder
%p
Click on icon to activate signin with one of the following services
-
enabled_social_providers
.
each
do
|
provider
|
%span
{
class:
oauth_active_class
(
provider
)
}
=
link_to
authbutton
(
provider
,
32
),
omniauth_authorize_path
(
User
,
provider
)
-
if
show_profile_username_tab?
%fieldset
.update-username
%legend
Username
=
form_for
@user
,
url:
update_username_profile_path
,
method: :put
,
remote:
true
do
|
f
|
%p
Changing your username will change path to all personl projects!
%div
=
f
.
text_field
:username
,
required:
true
,
class:
'input-xlarge input-xpadding'
%span
.loading-gif.hide
=
image_tag
"ajax_loader.gif"
%p
.light
=
user_url
(
@user
)
%div
=
f
.
submit
'Save username'
,
class:
"btn btn-save"
-
if
show_profile_remove_tab?
%fieldset
.remove-account
%legend
Remove account
%div
%p
Deleting an account has the following effects:
%ul
%li
All user content like authored issues, snippets, comments will be removed
-
rp
=
current_user
.
personal_projects
.
count
-
unless
rp
.
zero?
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
-
if
current_user
.
solo_owned_groups
.
present?
%li
Next groups will be abandoned. You should transfer or remove them:
%strong
#{
current_user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
=
link_to
'Delete account'
,
user_registration_path
,
confirm:
"REMOVE
#{
current_user
.
name
}
? Are you sure?"
,
method: :delete
,
class:
"btn btn-remove"
app/views/profiles/update_username.js.haml
View file @
ffec158d
-
if
@user
.
valid?
:plain
$('.update-username .update-success').show();
new Flash("Username sucessfully changed", "notice")
-
else
:plain
$('.update-username .update-failed').show();
new Flash("Username change failed -
#{
@user
.
errors
.
full_messages
.
first
}
", "alert")
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