Commit 22dd2240 authored by Robert Speicher's avatar Robert Speicher

Add 2FA status to Admin::Users#show

parent 6c8f0fe9
......@@ -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
%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
%span.light Can create groups:
%strong
......
......@@ -63,15 +63,35 @@ describe "Admin::Users", feature: true do
end
describe "GET /admin/users/:id" do
before do
it "should have user info" do
visit admin_users_path
click_link "#{@user.name}"
end
click_link @user.name
it "should have user info" do
expect(page).to have_content(@user.email)
expect(page).to have_content(@user.name)
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
describe "GET /admin/users/:id/edit" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment