cancan icon indicating copy to clipboard operation
cancan copied to clipboard

Role Infinite loop

Open austinklenk opened this issue 8 years ago • 1 comments

when i have a user that doesn't have a role, it has a Infinite loop and not redirecting to the login page

my rescue_from

 rescue_from CanCan::AccessDenied do |exception|
      if user_signed_in?
        flash[:error] = "Not authorized to view this page"
        session[:user_return_to] = nil
        redirect_to root_url

      else              
        flash[:error] = "You must first login to view this page"
        session[:user_return_to] = request.url
        redirect_to "/users/sign_in"
      end 
  end
Started GET "/" for ::1 at 2016-03-31 08:57:05 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 7ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:05 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 6ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:05 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 6ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:05 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 7ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:05 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 7ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:06 -0400
Processing by CustomersController#index as HTML
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 6ms (ActiveRecord: 0.3ms)


Started GET "/" for ::1 at 2016-03-31 08:57:06 -0400
Processing by CustomersController#index as HTML
  User Load (0.4ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
Redirected to http://localhost:3000/
Completed 302 Found in 7ms (ActiveRecord: 0.4ms)

austinklenk avatar Mar 31 '16 13:03 austinklenk

This project is discontinued. Go to https://github.com/CanCanCommunity/cancancan instead.

dgilperez avatar Apr 20 '16 15:04 dgilperez