Override Devise Sign-in with reCaptcha

589 views
Skip to first unread message

Bashar Abdullah

unread,
Mar 9, 2011, 8:55:32 AM3/9/11
to Devise
Hi,

I'm trying to override the Rails devise login to include recaptcha. I
followed the steps here

http://presentations.royvandewater.com/authentication-with-devise.html#8

however for some reason, authentication always fails. To isolate the
problem, I removed all my code and called super directly

class SessionsController < Devise::SessionsController
def create
super
end
end

file is at: Rails.root/app/controllers/sessions_controller.rb the
slide suggest Rails.root/app/controllers/sessions.rb but I assume that
was just a mistake. Trying it out didn't help either.

I even copied the full Sessions Controller code into my own, still
gives the problem. Authentication fails here specifically:

resource = warden.authenticate!(:scope => resource_name, :recall =>
"#{controller_path}#new")
Any idea what I might be doing wrong?

MissingHandle

unread,
Mar 9, 2011, 4:22:58 PM3/9/11
to Devise
I think this would hinge a lot on:
How exactly are you including recaptcha in your authentication?
Have you changed anything except generating the views?

similar to your slides, I overrode devise to use a username or email
and followed many of the steps outlined here:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address

And without seeing your code, one thing I am wondering is perhaps your
problem may have something to do with changing the authentication keys
for devise?

But more generally, why not keep the devise process the same, but make
passing the recaptcha a before_filter on the sessions_controller? To
me, this would seem cleaner and less error prone.

Bashar Abdullah

unread,
Mar 9, 2011, 4:49:17 PM3/9/11
to Devise
Sorry I didn't make it clear. To isolate the problem, I removed all
the recaptcha stuff and copied the exact sessions_controller code to
my overriding class, so it should be the same (logically), no
recaptcha or anything. But it still won't work.



On Mar 10, 12:22 am, MissingHandle <gabe.sara...@gmail.com> wrote:
> I think this would hinge a lot on:
> How exactly are you including recaptcha in your authentication?
> Have you changed anything except generating the views?
>
> similar to your slides, I overrode devise to use a username or email
> and followed many of the steps outlined here:https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-s...
Reply all
Reply to author
Forward
0 new messages