diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 123150a5..9850ff15 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,14 +23,14 @@ class ApplicationController < ActionController::Base if current_user.present? && current_user.banned? name = current_user.screen_name # obligatory '2001: A Space Odyssey' reference - flash[:notice] = t('flash.ban.error', name: name) + flash[:notice] = t(".banned", name: name) current_ban = current_user.bans.current.first unless current_ban&.reason.nil? - flash[:notice] += "\n#{t('flash.ban.reason', reason: current_ban.reason)}" + flash[:notice] += "\n#{t('.reason', reason: current_ban.reason)}" end unless current_ban&.permanent? # TODO format banned_until - flash[:notice] += "\n#{t('flash.ban.until', time: current_ban.expires_at)}" + flash[:notice] += "\n#{t('.until', time: current_ban.expires_at)}" end sign_out current_user redirect_to new_user_session_path diff --git a/config/locales/controllers.en.yml b/config/locales/controllers.en.yml index 6d525e75..e1cf05b1 100644 --- a/config/locales/controllers.en.yml +++ b/config/locales/controllers.en.yml @@ -183,6 +183,9 @@ en: user: sessions: create: + banned: "I'm sorry, %{name}, I'm afraid I can't do that." + reason: "Ban reason: %{reason}" + until: "Banned until: %{time}" info: "You have %{count} recovery codes remaining." error: :errors.invalid_otp registrations: