Forum: Ruby on Rails confirming change of email with devise

8fa0f5c2bf8ad238baa4e20cb0360ebd?d=identicon&s=25 Matt Harrison (iwasinnamuknow)
on 2011-04-19 06:46
(Received via mailing list)
Hi list,

I've found someone else asking this on the devise list but it didn't end
with a
suitable solution. I have posted there on that thread and asked for more
help but the
list is incredibly quiet and I haven't found any help yet. Hoping
someone here can
help out.

Devise allows me to require that users confirm their email addresses
when they sign
up but also allows them to change the address without confirmation.

I wanted to implement confirmation whenever the address is changed but
after thinking
about it I'm pretty stumped.

I could just set the account to require confirmation again, but what if
the user
accidentally entered an invalid/incorrect email address and doesn't
remember exactly
what they typed? They will be unable to login with their email address.

So, I need to store the new address somewhere safe, send a confirmation
again and when
confirmed, copy the new address to the right field.

I can work this solution out except for the first part. Getting the
profile saving
action to save the email address somewhere other than the email field
would require me
to hack the device gem around right?

I've been working with rails for a while but never got too deep and
dirty with it (or
gems). To me, it seems that if I go in and fiddle with the controller
inside devise,
then I'll end up with my own fork essentially and have to maintain that
as well as my
application.

Does anyone have any insights or tips concerning this?

TIA
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2011-04-19 15:20
(Received via mailing list)
On Apr 19, 2011, at 12:45 AM, Matt Harrison wrote:

> To me, it seems that if I go in and fiddle with the controller
> inside devise,
> then I'll end up with my own fork essentially and have to maintain
> that as well as my
> application.
>
> Does anyone have any insights or tips concerning this?

If you're in Rails 3, the Devise controllers may be extended in your
code, so you don't have to fork or unpack the gem into your
application. I haven't done this yet, but it's supposed to be one of
the big improvements over Rails 2.3 and its equivalent Devise. You
could also monkey-patch any part of Devise that wasn't actually being
handled inside Warden, if you needed to maintain a few changes. That
would require you to keep track of your changes along with upgrading
Devise, but it's probably less trouble than a full-on fork.

Walter
8fa0f5c2bf8ad238baa4e20cb0360ebd?d=identicon&s=25 Matt Harrison (iwasinnamuknow)
on 2011-04-20 00:17
(Received via mailing list)
On Tue, Apr 19, 2011 at 09:19:11AM -0400, Walter Lee Davis wrote:
>
> If you're in Rails 3, the Devise controllers may be extended in your
> code, so you don't have to fork or unpack the gem into your
> application. I haven't done this yet, but it's supposed to be one of
> the big improvements over Rails 2.3 and its equivalent Devise. You
> could also monkey-patch any part of Devise that wasn't actually being
> handled inside Warden, if you needed to maintain a few changes. That
> would require you to keep track of your changes along with upgrading
> Devise, but it's probably less trouble than a full-on fork.
>
> Walter

Thanks for the reply Walter,

It seems after a log of googling that the devise team are under fire
from a whole
bunch of people looking for this functionality. As such the team has
caved and is
adding re-confirmable emails as a configurable option in some upcoming
version.

I'll hang around for a bit and see when it materialises :)

Thanks
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.