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
iv
gitlab-ce
Commits
ed5e19a5
Commit
ed5e19a5
authored
Nov 15, 2011
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow user to reset his private token
parent
32ca0b8c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
1 deletion
+33
-1
app/controllers/profile_controller.rb
app/controllers/profile_controller.rb
+5
-0
app/views/layouts/profile.html.haml
app/views/layouts/profile.html.haml
+1
-1
app/views/profile/password.html.haml
app/views/profile/password.html.haml
+13
-0
config/routes.rb
config/routes.rb
+1
-0
spec/requests/profile_spec.rb
spec/requests/profile_spec.rb
+13
-0
No files found.
app/controllers/profile_controller.rb
View file @
ed5e19a5
...
...
@@ -25,4 +25,9 @@ class ProfileController < ApplicationController
render
:action
=>
"password"
end
end
def
reset_private_token
current_user
.
reset_authentication_token!
redirect_to
profile_password_path
end
end
app/views/layouts/profile.html.haml
View file @
ed5e19a5
...
...
@@ -18,7 +18,7 @@
.fixed
%aside
=
link_to
"Profile"
,
profile_path
,
:class
=>
current_page?
(
:controller
=>
"profile"
,
:action
=>
:show
)
?
"current"
:
nil
=
link_to
"Password"
,
profile_password_path
,
:class
=>
current_page?
(
:controller
=>
"profile"
,
:action
=>
:password
)
?
"current"
:
nil
=
link_to
"Password
& token
"
,
profile_password_path
,
:class
=>
current_page?
(
:controller
=>
"profile"
,
:action
=>
:password
)
?
"current"
:
nil
=
link_to
keys_path
,
:class
=>
controller
.
controller_name
==
"keys"
?
"current"
:
nil
do
Keys
-
unless
current_user
.
keys
.
empty?
...
...
app/views/profile/password.html.haml
View file @
ed5e19a5
...
...
@@ -18,3 +18,16 @@
.actions
=
f
.
submit
'Save'
,
:class
=>
"lbutton vm"
%br
%br
%br
=
form_for
@user
,
:url
=>
profile_reset_private_token_path
,
:method
=>
:put
do
|
f
|
%p
Current private token:
%strong
=
current_user
.
private_token
%em
.cred
keep it in secret!
.actions
=
f
.
submit
'Reset'
,
:confirm
=>
"Are you sure?"
,
:class
=>
"lbutton vm"
config/routes.rb
View file @
ed5e19a5
...
...
@@ -17,6 +17,7 @@ Gitlab::Application.routes.draw do
get
"errors/gitosis"
get
"profile/password"
,
:to
=>
"profile#password"
put
"profile/password"
,
:to
=>
"profile#password_update"
put
"profile/reset_private_token"
,
:to
=>
"profile#reset_private_token"
put
"profile/edit"
,
:to
=>
"profile#social_update"
get
"profile"
,
:to
=>
"profile#show"
get
"dashboard"
,
:to
=>
"dashboard#index"
...
...
spec/requests/profile_spec.rb
View file @
ed5e19a5
...
...
@@ -29,6 +29,19 @@ describe "Profile" do
it
{
@user
.
twitter
.
should
==
'testtwitter'
}
end
describe
"Reset private token"
do
before
do
visit
profile_password_path
end
it
"should reset private token"
do
user_first_token
=
@user
.
private_token
click_button
"Reset"
@user
.
reload
@user
.
private_token
.
should_not
==
user_first_token
end
end
describe
"Password update"
do
before
do
visit
profile_password_path
...
...
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