app/helpers/usman/authentication_helper.rb in usman-0.2.10 vs app/helpers/usman/authentication_helper.rb in usman-0.2.11
- old
+ new
@@ -70,10 +70,14 @@
render(:partial => 'usman/sessions/sign_in.js.erb', :handlers => [:erb], :formats => [:js])
}
end
end
+ def permission_denied
+ render :file => "layouts/kuppayam/401", layout: 'layouts/kuppayam/blank_with_nav', :status => :unauthorized
+ end
+
# This method is widely used to create the @current_user object from the session
# This method will return @current_user if it already exists which will save queries when called multiple times
def current_user
# Check if the user exists with the auth token present in session
@current_user = User.find_by_id(session[:id]) unless @current_user
@@ -107,10 +111,11 @@
unless @current_user && @current_user.has_role?("Site Admin")
respond_to do |format|
format.html {
#text = "#{I18n.t("authentication.permission_denied.heading")}: #{I18n.t("authentication.permission_denied.message")}"
#set_flash_message(text, :error, false) if defined?(flash) && flash
- redirect_after_unsuccessful_authentication
+ #redirect_after_unsuccessful_authentication
+ permission_denied
}
format.js {
@params_hsh = {}
@params_hsh[:client_app] = params[:client_app] if params[:client_app]
@params_hsh[:redirect_back_url] = params[:redirect_back_url] if params[:redirect_back_url]