diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 96b2e510..9c77fe48 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base def deny_access session[:return_to] = request.original_url - redirect_to login_url, :alert => 'Access denied!' + redirect_to login_url, :alert => I18n.t('application.controller.error_denied') end private @@ -37,7 +37,7 @@ class ApplicationController < ActionController::Base # No user at all: redirect to login page. session[:user_id] = nil session[:return_to] = request.original_url - redirect_to login_url, :alert => 'Authentication required!' + redirect_to login_url, :alert => I18n.t('application.controller.error_authn') else # We have an authenticated user, now check role... # Roles gets the user through his memberships. @@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base def authenticate_membership_or_admin @group = Group.find(params[:id]) unless @group.member?(@current_user) or @current_user.role_admin? - redirect_to root_path, alert: "Diese Aktion ist nur für Mitglieder der Gruppe erlaubt!" + redirect_to root_path, alert: I18n.t('application.controller.error_members_only') end end diff --git a/config/locales/de.yml b/config/locales/de.yml index d46ea8d3..f562bf87 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -212,6 +212,11 @@ de: workgroups: members: Mitglieder name: Name + application: + controller: + error_denied: + error_authn: + error_members_only: 'Diese Aktion ist nur für Mitglieder der Gruppe erlaubt!' article_categories: create: notice: Die Kategorie wurde gespeichert diff --git a/config/locales/en.yml b/config/locales/en.yml index bdb867c3..e42480e3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -212,6 +212,11 @@ en: workgroups: members: members name: name + application: + controller: + error_denied: 'Access denied!' + error_authn: 'Authentication required!' + error_members_only: 'This action is only available to members of the group!' article_categories: create: notice: Category was stored