user can reset his rss token on the account page
This commit is contained in:
parent
30141169ec
commit
6dc2ade49c
5 changed files with 40 additions and 4 deletions
|
@ -40,6 +40,14 @@ class ProfilesController < Profiles::ApplicationController
|
||||||
redirect_to profile_account_path
|
redirect_to profile_account_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset_rss_token
|
||||||
|
if current_user.reset_rss_token!
|
||||||
|
flash[:notice] = "RSS token was successfully reset"
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to profile_account_path
|
||||||
|
end
|
||||||
|
|
||||||
def audit_log
|
def audit_log
|
||||||
@events = AuditEvent.where(entity_type: "User", entity_id: current_user.id).
|
@events = AuditEvent.where(entity_type: "User", entity_id: current_user.id).
|
||||||
order("created_at DESC").
|
order("created_at DESC").
|
||||||
|
|
|
@ -8,11 +8,10 @@
|
||||||
.row.prepend-top-default
|
.row.prepend-top-default
|
||||||
.col-lg-3.profile-settings-sidebar
|
.col-lg-3.profile-settings-sidebar
|
||||||
%h4.prepend-top-0
|
%h4.prepend-top-0
|
||||||
= incoming_email_token_enabled? ? "Private Tokens" : "Private Token"
|
Private Tokens
|
||||||
%p
|
%p
|
||||||
Keep
|
Keep these tokens secret, anyone with access to them can interact with
|
||||||
= incoming_email_token_enabled? ? "these tokens" : "this token"
|
GitLab as if they were you.
|
||||||
secret, anyone with access to them can interact with GitLab as if they were you.
|
|
||||||
.col-lg-9.private-tokens-reset
|
.col-lg-9.private-tokens-reset
|
||||||
.reset-action
|
.reset-action
|
||||||
%p.cgray
|
%p.cgray
|
||||||
|
@ -23,6 +22,15 @@
|
||||||
.prepend-top-default
|
.prepend-top-default
|
||||||
= link_to 'Reset private token', reset_private_token_profile_path, method: :put, data: { confirm: "Are you sure?" }, class: "btn btn-default private-token"
|
= link_to 'Reset private token', reset_private_token_profile_path, method: :put, data: { confirm: "Are you sure?" }, class: "btn btn-default private-token"
|
||||||
|
|
||||||
|
.reset-action
|
||||||
|
%p.cgray
|
||||||
|
= label_tag "rss-token", "RSS Token", class: 'label-light'
|
||||||
|
= text_field_tag "rss-token", current_user.rss_token, class: "form-control", readonly: true, onclick: "this.select()"
|
||||||
|
%p.help-block
|
||||||
|
Your RSS token is used to create urls for personalized RSS feeds.
|
||||||
|
.prepend-top-default
|
||||||
|
= link_to 'Reset RSS token', reset_rss_token_profile_path, method: :put, data: { confirm: "Are you sure? This action will invalidate all your existing rss links." }, class: "btn btn-default rss-token"
|
||||||
|
|
||||||
- if incoming_email_token_enabled?
|
- if incoming_email_token_enabled?
|
||||||
.reset-action
|
.reset-action
|
||||||
%p.cgray
|
%p.cgray
|
||||||
|
|
|
@ -5,6 +5,7 @@ resource :profile, only: [:show, :update] do
|
||||||
|
|
||||||
put :reset_private_token
|
put :reset_private_token
|
||||||
put :reset_incoming_email_token
|
put :reset_incoming_email_token
|
||||||
|
put :reset_rss_token
|
||||||
put :update_username
|
put :update_username
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,21 @@ describe 'Profile account page', feature: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when I reset RSS token' do
|
||||||
|
before do
|
||||||
|
visit profile_account_path
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'resets RSS token' do
|
||||||
|
previous_token = find("#rss-token").value
|
||||||
|
|
||||||
|
click_link('Reset RSS token')
|
||||||
|
|
||||||
|
expect(page).to have_content 'RSS token was successfully reset'
|
||||||
|
expect(find('#rss-token').value).not_to eq(previous_token)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when I reset incoming email token' do
|
describe 'when I reset incoming email token' do
|
||||||
before do
|
before do
|
||||||
allow(Gitlab.config.incoming_email).to receive(:enabled).and_return(true)
|
allow(Gitlab.config.incoming_email).to receive(:enabled).and_return(true)
|
||||||
|
|
|
@ -151,6 +151,10 @@ describe ProfilesController, "routing" do
|
||||||
expect(put("/profile/reset_private_token")).to route_to('profiles#reset_private_token')
|
expect(put("/profile/reset_private_token")).to route_to('profiles#reset_private_token')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "to #reset_rss_token" do
|
||||||
|
expect(put("/profile/reset_rss_token")).to route_to('profiles#reset_rss_token')
|
||||||
|
end
|
||||||
|
|
||||||
it "to #show" do
|
it "to #show" do
|
||||||
expect(get("/profile")).to route_to('profiles#show')
|
expect(get("/profile")).to route_to('profiles#show')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue