heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.95k stars 5.55k forks source link

undefines method utc in reset_password_period_valid? method #5646

Closed jdonadob closed 11 months ago

jdonadob commented 11 months ago

undefines method utc for String. Recovering password, "reset_password_sent_at" variable contains a String value instead of Datetime value.

devise (4.9.2) ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt] Rails 7.0.6

carlosantoniodasilva commented 11 months ago

reset_password_sent_at is supposed to be a date time column in the DB, are yours setup like that?

Also, Devise only sets this value here: https://github.com/heartcombo/devise/blob/e2242a95f3bb2e68ec0e9a064238ff7af6429545/lib/devise/models/recoverable.rb#L93. Are you not setting it manually somewhere in the app?

jdonadob commented 11 months ago

Thank you @carlosantoniodasilva. It was precisely that. By mistake, the reset_password_sent_at field was created as a string type.

carlosantoniodasilva commented 11 months ago

:+1: cool, glad I could help.