mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-23 10:55:14 -05:00
Some checks failed
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
CSS Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.1) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.1) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.1) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Bundler Audit / security (push) Has been cancelled
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
64 lines
1.5 KiB
Ruby
64 lines
1.5 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Admin::SettingsHelper
|
|
def captcha_available?
|
|
Rails.configuration.x.captcha.secret_key.present? && Rails.configuration.x.captcha.site_key.present?
|
|
end
|
|
|
|
def login_activity_title(activity)
|
|
t(
|
|
"login_activities.#{login_activity_key(activity)}",
|
|
method: login_activity_method(activity),
|
|
ip: login_activity_ip(activity),
|
|
browser: login_activity_browser(activity)
|
|
)
|
|
end
|
|
|
|
private
|
|
|
|
def login_activity_key(activity)
|
|
activity.success? ? 'successful_sign_in_html' : 'failed_sign_in_html'
|
|
end
|
|
|
|
def login_activity_method(activity)
|
|
content_tag(
|
|
:span,
|
|
login_activity_method_string(activity),
|
|
class: 'target'
|
|
)
|
|
end
|
|
|
|
def login_activity_ip(activity)
|
|
content_tag(
|
|
:span,
|
|
activity.ip,
|
|
class: 'target'
|
|
)
|
|
end
|
|
|
|
def login_activity_browser(activity)
|
|
content_tag(
|
|
:span,
|
|
login_activity_browser_description(activity),
|
|
class: 'target',
|
|
title: activity.user_agent
|
|
)
|
|
end
|
|
|
|
def login_activity_method_string(activity)
|
|
if activity.omniauth?
|
|
t("auth.providers.#{activity.provider}")
|
|
else
|
|
t("login_activities.authentication_methods.#{activity.authentication_method}")
|
|
end
|
|
end
|
|
|
|
def login_activity_browser_description(activity)
|
|
t(
|
|
'sessions.description',
|
|
browser: t(activity.browser, scope: 'sessions.browsers', default: activity.browser.to_s),
|
|
platform: t(activity.platform, scope: 'sessions.platforms', default: activity.platform.to_s)
|
|
)
|
|
end
|
|
end
|