While I agree that this solution is clever in it's simplicity of the
solution- I feel like the one thing I don't like about it is that it
leaves the potential for someone to be locked out of their account.
For instance,
User misspells their new email, doesn't notice, closes their session,
forgets about confirming in the moment, either tries to sign in again
later or notices they didn't get an email, try to get confirmation
instructions only to find that they can't because their new email is
wrong.
So, I grant you that is one oblivious user, but for the sake of
argument let's say avoiding lockout is the goal. I ask how you all
how you would fix this problem with minimal effort..?
What I'm thinking at the moment is:
- before_update callback that detects change in email attribute,
reverts email to old value, but creates a ChangeEmail instance w/the
new value.
- ChangeEmail instance sends user an email w/token.
- visiting url updates the user's email (bypassing the before_update
callback) and destroys ChangeEmail instance.
And well, I'm not in love with it b/c I feel like it's a bit of
overkill (an extra model + controller_action), but I also can't think
of anything simpler that avoids lockout through user carelessness.
Any thoughts? Worthy of an addition to devise/confirmable?
On Jan 25, 1:39 pm, Walter Lee Davis <
wa...@wdstudio.com> wrote:
> On Jan 25, 2011, at 1:13 PM, Ashwin Mangale wrote:
>
>
>
>
>
>
>
>
>
> > One way is to have a before_save method to trackemailaddress
> > change. If it has, then you can nullify confirmable fields ( token
> > and timestamp ). This will prompt a new confirmationemailto be
> > sent and the account will be locked till confirmed.
>
> > - Ashwin
>
> > On Tue, Jan 25, 2011 at 20:59, S. Widmann
> > <
sebastian.widm...@gmail.com> wrote:
> > Hi,
>
> > has somebody already implemented that or has an idea for me, how to
> > implement that?
>
> > After the registration, the user comfirms the profile by clicking
> > the link in the mail. Now, the user changes the mail adress. The new
> > mail address is not comfirmed, but active. I don't want that. If the
> > user changes the mail address, the mail address should be stored
> > temporary. A new confirmation mail is sent to the newemailadress
> > with a new confirmation link. If this new link is pressed, the new
> > (temporary)emailaddress becomes active and the old (original) one