Update OAuth removal instructions (#20036)
This commit is contained in:
parent
79f86d2179
commit
bbf2719582
4 changed files with 24 additions and 5 deletions
|
|
@ -58,6 +58,11 @@
|
|||
</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif @user.identities.enabled.size == 1 %>
|
||||
<div class="grid gap-2">
|
||||
<h3><%= t("views.settings.account.remove.heading") %></h3>
|
||||
<p><%= t("views.settings.account.remove.unable_to_remove") %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="grid gap-2">
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ en:
|
|||
you will have to do so in your settings for the specific provider:
|
||||
confirm: Are you absolutely sure you want to remove your %{provider} account?
|
||||
submit: Remove %{provider}
|
||||
unable_to_remove: You are unable to remove one of your authentication methods as you need a remaining method to authenticate you. Please add another authentication method above before continuing.
|
||||
billing:
|
||||
heading: Billing
|
||||
add: Add Credit Card
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ fr:
|
|||
you will have to do so in your settings for the specific provider:
|
||||
confirm: Are you absolutely sure you want to remove your %{provider} account?
|
||||
submit: Remove %{provider}
|
||||
unable_to_remove: Vous ne pouvez pas supprimer l'une de vos méthodes d'authentification car vous avez besoin d'une méthode restante pour vous authentifier. Veuillez ajouter une autre méthode d'authentification ci-dessus avant de continuer.
|
||||
billing:
|
||||
heading: Billing
|
||||
add: Add Credit Card
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ RSpec.describe "UserSettings" do
|
|||
|
||||
describe ":account" do
|
||||
let(:remove_oauth_section) { "Remove OAuth Associations" }
|
||||
let(:remove_oauth_description) { "You can remove one of your authentication methods" }
|
||||
let(:remove_oauth_instructions) { "Please add another authentication method" }
|
||||
let(:user) { create(:user, :with_identity) }
|
||||
|
||||
before do
|
||||
|
|
@ -122,28 +124,38 @@ RSpec.describe "UserSettings" do
|
|||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
|
||||
it "shows the 'Remove OAuth' section if a user has multiple enabled identities" do
|
||||
it "shows the description if a user has multiple enabled identities" do
|
||||
allow(Authentication::Providers).to receive(:enabled).and_return(Authentication::Providers.available)
|
||||
providers = Authentication::Providers.available.first(2)
|
||||
allow(user).to receive(:identities).and_return(user.identities.where(provider: providers))
|
||||
|
||||
get user_settings_path(tab: "account")
|
||||
expect(response.body).to include(remove_oauth_section)
|
||||
expect(response.body).to include(remove_oauth_description)
|
||||
expect(response.body).not_to include(remove_oauth_instructions)
|
||||
end
|
||||
|
||||
it "hides the 'Remove OAuth' section if a user has one enabled identity" do
|
||||
it "shows instructions how to remove an identity if a user has one enabled identity" do
|
||||
provider = Authentication::Providers.available.first
|
||||
allow(Authentication::Providers).to receive(:enabled).and_return([provider])
|
||||
allow(user).to receive(:identities).and_return(user.identities.where(provider: provider))
|
||||
|
||||
get user_settings_path(tab: "account")
|
||||
expect(response.body).not_to include(remove_oauth_section)
|
||||
expect(response.body).not_to include(remove_oauth_description)
|
||||
expect(response.body).to include(remove_oauth_instructions)
|
||||
end
|
||||
|
||||
it "hides the 'Remove OAuth' section if a user has one enabled identity and one disabled" do
|
||||
it "shows instructions how to remove an identity if a user has one enabled identity and one disabled" do
|
||||
provider = Authentication::Providers.available.first
|
||||
allow(Authentication::Providers).to receive(:enabled).and_return([provider])
|
||||
|
||||
get user_settings_path(tab: "account")
|
||||
expect(response.body).not_to include(remove_oauth_description)
|
||||
expect(response.body).to include(remove_oauth_instructions)
|
||||
end
|
||||
|
||||
it "hides the 'Remove OAuth' section if a user has no enabled identity" do
|
||||
allow(Authentication::Providers).to receive(:enabled).and_return([])
|
||||
|
||||
get user_settings_path(tab: "account")
|
||||
expect(response.body).not_to include(remove_oauth_section)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue