confirming change of email with devise

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

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 :slight_smile:

Thanks