Add 2FA status to Admin::Users#show
This commit is contained in:
parent
6c8f0fe906
commit
22dd2240a6
2 changed files with 33 additions and 5 deletions
|
@ -50,6 +50,14 @@
|
||||||
= link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-xs btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
|
= link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-xs btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
|
||||||
%i.fa.fa-times
|
%i.fa.fa-times
|
||||||
|
|
||||||
|
%li.two-factor-status
|
||||||
|
%span.light Two-factor Authentication:
|
||||||
|
%strong{class: @user.two_factor_enabled? ? 'cgreen' : 'cred'}
|
||||||
|
- if @user.two_factor_enabled?
|
||||||
|
Enabled
|
||||||
|
- else
|
||||||
|
Disabled
|
||||||
|
|
||||||
%li
|
%li
|
||||||
%span.light Can create groups:
|
%span.light Can create groups:
|
||||||
%strong
|
%strong
|
||||||
|
|
|
@ -63,15 +63,35 @@ describe "Admin::Users", feature: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /admin/users/:id" do
|
describe "GET /admin/users/:id" do
|
||||||
before do
|
|
||||||
visit admin_users_path
|
|
||||||
click_link "#{@user.name}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should have user info" do
|
it "should have user info" do
|
||||||
|
visit admin_users_path
|
||||||
|
click_link @user.name
|
||||||
|
|
||||||
expect(page).to have_content(@user.email)
|
expect(page).to have_content(@user.email)
|
||||||
expect(page).to have_content(@user.name)
|
expect(page).to have_content(@user.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'Two-factor Authentication status' do
|
||||||
|
it 'shows when enabled' do
|
||||||
|
@user.update_attribute(:two_factor_enabled, true)
|
||||||
|
|
||||||
|
visit admin_user_path(@user)
|
||||||
|
|
||||||
|
expect_two_factor_status('Enabled')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows when disabled' do
|
||||||
|
visit admin_user_path(@user)
|
||||||
|
|
||||||
|
expect_two_factor_status('Disabled')
|
||||||
|
end
|
||||||
|
|
||||||
|
def expect_two_factor_status(status)
|
||||||
|
page.within('.two-factor-status') do
|
||||||
|
expect(page).to have_content(status)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /admin/users/:id/edit" do
|
describe "GET /admin/users/:id/edit" do
|
||||||
|
|
Loading…
Reference in a new issue