Add flash type error.Rewrite controllers to use common flash style with redirect_to

This commit is contained in:
Nishanth Vijayan 2016-03-10 14:25:38 +05:30
parent dcdceb7c6d
commit 434eb90b76
16 changed files with 81 additions and 85 deletions

View file

@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base
include ApplicationHelper
add_flash_types :error
protect_from_forgery with: :exception
before_filter :get_conferences
before_filter :store_location
@ -52,16 +53,15 @@ class ApplicationController < ActionController::Base
rescue_from IChainRecordNotFound do
Rails.logger.debug('IChain Record was not Unique!')
sign_out(current_user)
flash[:error] = 'Your E-Mail adress is already registered at OSEM. Please contact the admin if you want to attach your openSUSE Account to OSEM!'
redirect_to root_path
redirect_to root_path,
error: 'Your E-Mail adress is already registered at OSEM. Please contact the admin if you want to attach your openSUSE Account to OSEM!'
end
rescue_from UserDisabled do
Rails.logger.debug('User is disabled!')
sign_out(current_user)
mail = User.admin.first ? User.admin.first.email : 'the admin!'
flash[:error] = "This User is disabled. Please contact #{mail}!"
redirect_to User.ichain_logout_url
redirect_to User.ichain_logout_url, error: "This User is disabled. Please contact #{mail}!"
end
def not_found