mailr/app/controllers/internal_controller.rb

54 lines
1.3 KiB
Ruby
Raw Normal View History

2011-07-24 22:22:13 +02:00
class InternalController < ApplicationController
2011-09-16 19:44:29 +02:00
before_filter :check_current_user ,:selected_folder, :get_current_folders, :only => [:about]
2011-07-24 22:22:13 +02:00
theme :theme_resolver
layout "simple"
2011-09-16 19:44:29 +02:00
2011-09-05 19:08:22 +02:00
ERRORS = [
:internal_server_error,
:not_found,
:unprocessable_entity
].freeze
ERRORS.each do |e|
define_method e do
@title = t(e,:scope=>:internal)
@error = t(e,:scope=>:internal)
render 'error'
end
end
2011-08-02 23:12:17 +02:00
2011-09-05 19:08:22 +02:00
def error
@title = t(:unspecified_error,:scope=>:internal)
@error = params[:error] || t(:unspecified_error,:scope=>:internal)
2011-07-27 20:34:30 +02:00
end
def imaperror
2011-09-05 19:08:22 +02:00
@title = t(:imap_error,:scope => :internal)
@error = params[:error] || t(:unspecified_error, :scope => :internal)
2011-07-27 20:34:30 +02:00
logger.error "!!! InternalControllerImapError: " + @error
2011-07-29 20:05:47 +02:00
render 'error'
end
def loginfailure
reset_session
2011-08-16 20:05:58 +02:00
flash[:error] = t(:login_failure,:scope=>:user)
2011-07-29 20:05:47 +02:00
@current_user = nil
redirect_to :controller=>'user', :action => 'login'
2011-07-24 22:22:13 +02:00
end
2011-08-24 19:20:13 +02:00
def onlycanlogins
reset_session
flash[:error] = t(:only_can_logins,:scope=>:user)
@current_user = nil
redirect_to :controller=>'user', :action => 'login'
end
2011-09-16 19:44:29 +02:00
def about
render 'internal/about', :layout => 'application'
end
2011-07-24 22:22:13 +02:00
end