diff --git a/app/assets/stylesheets/account/verify-account.scss b/app/assets/stylesheets/account/verify-account.scss
new file mode 100644
index 000000000..2ba30afe7
--- /dev/null
+++ b/app/assets/stylesheets/account/verify-account.scss
@@ -0,0 +1,14 @@
+.verify-account {
+ padding-right: $line-height / 2;
+
+ .already-verified {
+ @include has-fa-icon(check, solid);
+ color: $color-success;
+ margin-top: $line-height;
+
+ &::before {
+ color: $check;
+ font-size: 1.4em;
+ }
+ }
+}
diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss
index 0197288f4..d0ef59c55 100644
--- a/app/assets/stylesheets/layout.scss
+++ b/app/assets/stylesheets/layout.scss
@@ -1228,10 +1228,6 @@ form {
margin-right: $line-height / 2;
}
- .verify-account {
- padding-right: $line-height / 2;
- }
-
.final-votes-info {
background: $warning-bg;
border: 1px solid $warning-border;
@@ -1270,16 +1266,6 @@ form {
vertical-align: top;
}
-.user-permissions {
-
- p {
- span {
- color: $text-medium;
- font-size: rem-calc(12);
- }
- }
-}
-
.notifications-list {
position: relative;
@@ -1666,21 +1652,6 @@ table {
}
}
-.verify-account {
- padding-right: $line-height / 2;
-
- .already-verified {
- color: $check;
- line-height: $line-height * 2;
-
- .icon-check {
- font-size: rem-calc(24);
- line-height: rem-calc(45);
- vertical-align: middle;
- }
- }
-}
-
.verify {
margin-bottom: $line-height * 2;
margin-top: $line-height;
diff --git a/app/components/account/verify_account_component.html.erb b/app/components/account/verify_account_component.html.erb
new file mode 100644
index 000000000..af9538c35
--- /dev/null
+++ b/app/components/account/verify_account_component.html.erb
@@ -0,0 +1,17 @@
+
+ <% if account.level_three_verified? %>
+
+ <%= t("account.show.verified_account") %>
+
+ <% else %>
+
+ <%= t("account.show.user_permission_verify") %>
+
+
+ <% if account.level_two_verified? %>
+ <%= link_to t("account.show.finish_verification"), verification_path, class: "button success" %>
+ <% else %>
+ <%= link_to t("account.show.verify_my_account"), verification_path, class: "button success" %>
+ <% end %>
+ <% end %>
+
diff --git a/app/components/account/verify_account_component.rb b/app/components/account/verify_account_component.rb
new file mode 100644
index 000000000..42f2a5cd6
--- /dev/null
+++ b/app/components/account/verify_account_component.rb
@@ -0,0 +1,11 @@
+class Account::VerifyAccountComponent < ApplicationComponent
+ attr_reader :account
+
+ def initialize(account)
+ @account = account
+ end
+
+ def render?
+ Setting["feature.user.skip_verification"].blank? && !account.organization?
+ end
+end
diff --git a/app/views/account/show.html.erb b/app/views/account/show.html.erb
index 34c9d104c..77e22a6a8 100644
--- a/app/views/account/show.html.erb
+++ b/app/views/account/show.html.erb
@@ -94,27 +94,7 @@
<%= t("account.show.user_permission_info") %>
<%= render Account::PermissionsListComponent.new(current_user) %>
-
-
- <%= t("account.show.user_permission_verify") %>
-
-
- <% unless @account.organization? %>
-
-
- <% if current_user.level_three_verified? %>
-
-
- <%= t("account.show.verified_account") %>
-
- <% elsif current_user.level_two_verified? %>
- <%= link_to t("account.show.finish_verification"), verification_path, class: "button success" %>
- <% else %>
- <%= link_to t("account.show.verify_my_account"), verification_path, class: "button success" %>
- <% end %>
-
-
- <% end %>
+ <%= render Account::VerifyAccountComponent.new(@account) %>
<% end %>
diff --git a/spec/components/account/verify_account_component_spec.rb b/spec/components/account/verify_account_component_spec.rb
new file mode 100644
index 000000000..1b425ec82
--- /dev/null
+++ b/spec/components/account/verify_account_component_spec.rb
@@ -0,0 +1,54 @@
+require "rails_helper"
+
+describe Account::VerifyAccountComponent do
+ context "verification is enabled" do
+ before { Setting["feature.user.skip_verification"] = false }
+
+ it "shows a link to verify account to unverified users" do
+ account = User.new
+
+ render_inline Account::VerifyAccountComponent.new(account)
+
+ expect(page).to have_content "To perform all the actions verify your account."
+ expect(page).to have_link "Verify my account"
+ end
+
+ it "shows a link to complete verification to level two verified users" do
+ account = User.new(level_two_verified_at: Time.current)
+
+ render_inline Account::VerifyAccountComponent.new(account)
+
+ expect(page).to have_content "To perform all the actions verify your account."
+ expect(page).to have_link "Complete verification"
+ end
+
+ it "shows information about a verified account to level three verified users" do
+ account = User.new(verified_at: Time.current)
+
+ render_inline Account::VerifyAccountComponent.new(account)
+
+ expect(page).not_to have_content "To perform all the actions verify your account."
+ expect(page).to have_content "Account verified"
+ end
+
+ it "does not show verification info to organizations" do
+ account = User.new(organization: Organization.new)
+
+ render_inline Account::VerifyAccountComponent.new(account)
+
+ expect(page).not_to be_rendered
+ end
+ end
+
+ context "verification is disabled" do
+ before { Setting["feature.user.skip_verification"] = true }
+
+ it "does not show verification info to anyone" do
+ account = User.new
+
+ render_inline Account::VerifyAccountComponent.new(account)
+
+ expect(page).not_to be_rendered
+ end
+ end
+end