Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Role Infinite loop #1039

Open
austinklenk opened this issue Mar 31, 2016 · 1 comment
Open

Role Infinite loop #1039

austinklenk opened this issue Mar 31, 2016 · 1 comment

Comments

@austinklenk
Copy link

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)
@dgilperez
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants