In the config/initializers/devise.rb
I have set config.reconfirmable = true
and am now able to use Devises process of changing emails with sending out a confirmation mail, that contains a confirmation token.
I am also aware that I can set the expiration period of devise tokens with config.confirm_within = 2.weeks
.
But this seems to be a global options for both confirmation tokens:
I can't find anything in the documentation to set different expiration dates for those two tokens. I am searching for something like this config.confirm_reconfirmable_within = 3.days
Am I missing something here or is it not possible?
My short answer is it is not possible in the default Devise.
As the official doc lists, confirm_within
is the only related parameter for it.
I guess few users want to set different expiration periods for confirmation emails and so it is perhaps not surprising the parameter is not configurable about the point…
It seems it is controlled in Confirmable#confirm
defined in vendor/bundle/ruby/3.0.0/gems/devise-**/lib/devise/models/confirmable.rb
. So, you can redefine the method to suit your need if you wish.