Disclose permanent ban duration in login notice
This commit is contained in:
parent
34d97ed7c4
commit
66878544bf
|
@ -30,10 +30,13 @@ class ApplicationController < ActionController::Base
|
|||
# obligatory '2001: A Space Odyssey' reference
|
||||
flash[:notice] = t("user.sessions.create.banned", name:)
|
||||
current_ban = current_user.bans.current.first
|
||||
unless current_ban&.reason.nil?
|
||||
unless current_ban&.reason.empty?
|
||||
flash[:notice] += "\n#{t('user.sessions.create.reason', reason: current_ban.reason)}"
|
||||
end
|
||||
unless current_ban&.permanent?
|
||||
|
||||
if current_ban&.permanent?
|
||||
flash[:notice] += "\n#{t('user.sessions.create.permanent')}"
|
||||
else
|
||||
# TODO format banned_until
|
||||
flash[:notice] += "\n#{t('user.sessions.create.until', time: current_ban.expires_at)}"
|
||||
end
|
||||
|
|
|
@ -173,6 +173,7 @@ en:
|
|||
sessions:
|
||||
create:
|
||||
banned: "I'm sorry, %{name}, I'm afraid I can't do that."
|
||||
permanent: "You are banned permanently."
|
||||
reason: "Ban reason: %{reason}"
|
||||
until: "Banned until: %{time}"
|
||||
info:
|
||||
|
|
Loading…
Reference in New Issue