backport a fix - https://github.com/plataformatec/devise/pull/2074