Devise: Setting allow_unconfirmed_access_for to nil

Created on 13 Feb 2013  ·  6Comments  ·  Source: heartcombo/devise

As you're probably aware, Devise's :confirmable module has a setting called allow_unconfirmed_access_for that determines how long a user can access their account for before they are forced to confirm its email address. Currently, there's no way to remove this restriction entirely like there is for confirm_within. I can work around this by setting allow_unconfirmed_access_for to some ridiculous value like 1000.years, but that feels like a rather dirty solution. I'd prefer to just set it to nil and have that remove the restriction, but currently doing that yields the following error:

undefined method `ago' for nil:NilClass
devise (2.2.2) lib/devise/models/confirmable.rb:162:in `confirmation_period_valid?'

Most helpful comment

@nashby Because I still want to enable or disable access to certain features of the website based on whether the user has a confirmed email address or not.

All 6 comments

@Ajedi32 hmmm, I don't follow. If you want to allow unconfirmed access for users all the time why do you need to use confirmable module at all? :)

@nashby Because I still want to enable or disable access to certain features of the website based on whether the user has a confirmed email address or not.

Wow, that was fast. Thanks. :+1:

Nice! =D

Please mention the use of nil for allow_unconfirmed_access_for in docs.

I read docs, then googled, then found a StackOverflow answer mentioning the use of value nil.

I'm with @r-a-o. I've just spend a lot more time than i want to admit to figure out my problem was solved by config.allow_unconfirmed_access_for = nil

Was this page helpful?
0 / 5 - 0 ratings