Max
Max

Reputation: 1459

Devise after_sign_in_path redirect loop

I'm trying redirect after signing in, except for some paths.

def after_sign_in_path_for(user)
  if request.fullpath =~ /some_path/
    request.fullpath
  elsif # redirect accordingly
    # ...
  else ...
    ...
  end
end

And it's doing a redirect loop.

Any ideas?

Upvotes: 1

Views: 316

Answers (1)

Max
Max

Reputation: 1459

Figured it out. It has to do with weird and undocumented behavior of the /users/password/edit path, which is only used for unauthenticated password resets. Using /users/edit solved this problem.

Had to dig through Devise source code to understand this.

Upvotes: 1

Related Questions