简体   繁体   中英

Devise skip reconfirmation

I need to skip, not the confirmation email, but REconfirmation emails.

Suppose I have a user with a confirmed email. I want to manually change its email for testing/support purposes

u.email # => email1@example.com
u.email = 'email2@example.com'
u.save
u.email # => email1@example.com
u.unconfirmed_email # 'email2@example.com'

I tried u.skip_confirmation! before and after saving but it doesn't seem to help for reconfirmation emails... the unconfirmed email is not transferred to the email field

Is there any way to force the new unconfirmed email to switch to the normal email ?

That method only skips sending of mail, that does not confirm the new mail which is stored in unconfirmed_mail . maybe you could just confirm the user manually like u.confirm . confirm method works only after object is saved.

To skip reconfirmation email notification use : skip_confirmation_notification!

Here is the Code reference .

Or try skip_reconfirmation! this may confirm new email and avoid sending email notification. I have not used it but I understand so from the comment in code reference above(next method of skip_confirmation_notification! defination). so try it and let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM