allow user to reset his private token
This commit is contained in:
parent
32ca0b8cae
commit
ed5e19a518
5 changed files with 33 additions and 1 deletions
|
@ -25,4 +25,9 @@ class ProfileController < ApplicationController
|
||||||
render :action => "password"
|
render :action => "password"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset_private_token
|
||||||
|
current_user.reset_authentication_token!
|
||||||
|
redirect_to profile_password_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
.fixed
|
.fixed
|
||||||
%aside
|
%aside
|
||||||
= link_to "Profile", profile_path, :class => current_page?(:controller => "profile", :action => :show) ? "current" : nil
|
= 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
|
= link_to keys_path, :class => controller.controller_name == "keys" ? "current" : nil do
|
||||||
Keys
|
Keys
|
||||||
- unless current_user.keys.empty?
|
- unless current_user.keys.empty?
|
||||||
|
|
|
@ -18,3 +18,16 @@
|
||||||
.actions
|
.actions
|
||||||
= f.submit 'Save', :class => "lbutton vm"
|
= 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"
|
||||||
|
|
|
@ -17,6 +17,7 @@ Gitlab::Application.routes.draw do
|
||||||
get "errors/gitosis"
|
get "errors/gitosis"
|
||||||
get "profile/password", :to => "profile#password"
|
get "profile/password", :to => "profile#password"
|
||||||
put "profile/password", :to => "profile#password_update"
|
put "profile/password", :to => "profile#password_update"
|
||||||
|
put "profile/reset_private_token", :to => "profile#reset_private_token"
|
||||||
put "profile/edit", :to => "profile#social_update"
|
put "profile/edit", :to => "profile#social_update"
|
||||||
get "profile", :to => "profile#show"
|
get "profile", :to => "profile#show"
|
||||||
get "dashboard", :to => "dashboard#index"
|
get "dashboard", :to => "dashboard#index"
|
||||||
|
|
|
@ -29,6 +29,19 @@ describe "Profile" do
|
||||||
it { @user.twitter.should == 'testtwitter' }
|
it { @user.twitter.should == 'testtwitter' }
|
||||||
end
|
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
|
describe "Password update" do
|
||||||
before do
|
before do
|
||||||
visit profile_password_path
|
visit profile_password_path
|
||||||
|
|
Loading…
Reference in a new issue