Weird redirect after login with Devise

357 views
Skip to first unread message

Felipe Coury

unread,
Nov 10, 2011, 1:23:59 PM11/10/11
to Devise
(xpost from http://stackoverflow.com/questions/8084335/weird-redirect-after-login-with-devise)

I have this application where I use Devise and, after login the user
is redirected to a blank page with the path `/users/sign_in.user`.

Why is Devise redirecting to this path? Here's the log entry I get:

Started POST "/users/sign_in.user" for 127.0.0.1 at 2011-11-10
15:56:03 -0200
Processing by Users::SessionsController#create as
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"ukqyLFgApCSybuIlVynPwj/xgdI/WuHLxoFxOsY4wgQ=",
"user"=>{"email"=>"felipe...@gmail.com", "password"=>"[FILTERED]",
"remember_me"=>"0"}, "commit"=>"Entrar"}
User Load (1.8ms) SELECT `users`.* FROM `users` WHERE
`users`.`email` = 'felipe...@gmail.com' LIMIT 1
(0.2ms) BEGIN
(1.0ms) UPDATE `users` SET `last_sign_in_at` = '2011-11-09
18:47:04', `current_sign_in_at` = '2011-11-10 17:56:04',
`sign_in_count` = 14, `updated_at` = '2011-11-10 17:56:04' WHERE
`users`.`id` = 1
(0.3ms) COMMIT
Completed 406 Not Acceptable in 112ms

Here's my complete `routes.rb` file:


MyApp::Application.routes.draw do
root :to => "site#home"
match 'biblioteca' => 'site#library', :as => :library

devise_for :users, :controllers => { :sessions => "users/
sessions" }
devise_for :admin_users, ActiveAdmin::Devise.config

ActiveAdmin.routes(self)

resources :cursos
resources :matriculas
resources :modulo_statuses
end

I tried using `after_sign_in_path_for` in `ApplicationController`:


def after_sign_in_path_for(resource_or_scope)
Rails.logger.info "***** LOGGED IN, GOING TO #{root_path}"
root_path
end

But the log entry doesn't even appear.

Does anyone have any idea why this happens?

Felipe Coury

unread,
Nov 10, 2011, 2:04:44 PM11/10/11
to Devise
Valim himself responded here:

http://stackoverflow.com/questions/8084335/weird-redirect-after-login-with-devise

Thanks!

On Nov 10, 4:23 pm, Felipe Coury <felipe.co...@gmail.com> wrote:
> (xpost fromhttp://stackoverflow.com/questions/8084335/weird-redirect-after-login...)
>
> I have this application where I use Devise and, after login the user
> is redirected to a blank page with the path `/users/sign_in.user`.
>
> Why is Devise redirecting to this path? Here's the log entry I get:
>
>     Started POST "/users/sign_in.user" for 127.0.0.1 at 2011-11-10
> 15:56:03 -0200
>       Processing by Users::SessionsController#create as
>       Parameters: {"utf8"=>"✓",
> "authenticity_token"=>"ukqyLFgApCSybuIlVynPwj/xgdI/WuHLxoFxOsY4wgQ=",
> "user"=>{"email"=>"felipe.co...@gmail.com", "password"=>"[FILTERED]",
> "remember_me"=>"0"}, "commit"=>"Entrar"}
>       User Load (1.8ms)  SELECT `users`.* FROM `users` WHERE
> `users`.`email` = 'felipe.co...@gmail.com' LIMIT 1
Reply all
Reply to author
Forward
0 new messages