UX: Display lock icon in admin user lists when user has 2FA enabled.

This commit is contained in:
Guo Xiang Tan 2018-02-22 08:59:11 +08:00
parent edf326a9a5
commit 1b04d881c5
4 changed files with 16 additions and 2 deletions

View File

@ -98,6 +98,10 @@
{{#if user.moderator}}
{{d-icon "shield" title="admin.moderator" }}
{{/if}}
{{#if user.second_factor_enabled}}
{{d-icon "lock" title="admin.user.second_factor_enabled" }}
{{/if}}
</td>
</tr>
{{/each}}

View File

@ -25,7 +25,8 @@ class AdminUserListSerializer < BasicUserSerializer
:silenced,
:silenced_till,
:time_read,
:staged
:staged,
:second_factor_enabled
[:days_visited, :posts_read_count, :topics_entered, :post_count].each do |sym|
attributes sym
@ -115,4 +116,12 @@ class AdminUserListSerializer < BasicUserSerializer
SiteSetting.must_approve_users
end
def include_second_factor_enabled?
object.totp_enabled?
end
def second_factor_enabled
true
end
end

View File

@ -3471,6 +3471,7 @@ en:
private_topics_count: Private Topics
posts_read_count: Posts Read
post_count: Posts Created
second_factor_enabled: Two Factor Authentication Enabled
topics_entered: Topics Viewed
flags_given_count: Flags Given
flags_received_count: Flags Received

View File

@ -63,7 +63,7 @@ class AdminUserIndexQuery
if params[:stats].present? && params[:stats] == false
klass.order(order.reject(&:blank?).join(","))
else
klass.includes(:user_stat).order(order.reject(&:blank?).join(","))
klass.includes(:user_stat, :user_second_factor).order(order.reject(&:blank?).join(","))
end
end