UX: Add description to the 2FA page when adding new admins (#16098)

This PR adds an extra description to the 2FA page when granting a user admin access. It also introduces a general system for adding customized descriptions that can be used by future actions.

(Follow-up to dd6ec65061e747442f3d2ab0eb60764e88eff2d8)
This commit is contained in:
Osama Sayegh
2022-03-04 06:43:06 +03:00
committed by GitHub
parent 967946378a
commit 8c71878ff5
11 changed files with 53 additions and 4 deletions

View File

@ -94,7 +94,7 @@ describe SecondFactor::AuthManager do
action
.expects(:second_factor_auth_required!)
.with({ expect_me: 131 })
.returns({ callback_params: { call_me_back: 4314 }, redirect_path: "/gg" })
.returns({ callback_params: { call_me_back: 4314 }, redirect_path: "/gg", description: "hello world!" })
.once
action.expects(:second_factor_auth_completed!).never
manager = create_manager(action)
@ -114,6 +114,7 @@ describe SecondFactor::AuthManager do
expect(challenge[:redirect_path]).to eq("/gg")
expect(challenge[:allowed_methods]).to eq(manager.allowed_methods.to_a)
expect(challenge[:callback_params]).to eq({ call_me_back: 4314 })
expect(challenge[:description]).to eq("hello world!")
end
it "sets the redirect_path to the root path if second_factor_auth_required! doesn't specify a redirect_path" do