Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Devise 2.0, reconfirmable and a new user #1515

Closed
mrship opened this Issue Dec 20, 2011 · 3 comments

Comments

Projects
None yet
2 participants

mrship commented Dec 20, 2011

I've just upgraded to 2.0.RC primarily to use the new reconfirmable logic for changing an email. However, when I sign up as a new user, the confirm! method in Confirmable fails to save the newly confirmed user with validation messages about the lack of a password. Looking at the code: (line 47 of confirmable.rb)

if self.class.reconfirmable
  @bypass_postpone = true
  self.email = unconfirmed_email if unconfirmed_email.present?
  self.unconfirmed_email = nil
  save
else
  save(:validate => false)
end

the reconfirmable path is validating the new user, whereas the non-reconfirmable path is not. That appears to be causing the validation error. Is it intentional that the validation is required for the reconfirmable path? As far as I can tell there is no way that the password is going to validate as we don't have the password attribute to validate on at that stage.

I may be missing something, but should this not call save(:validate => false) in both instances?

Owner

josevalim commented Dec 20, 2011

Yeah, we should have that in both instances. :) Thanks for reporting and trying Devise 2.0.0.RC out. I will push a fix shortly, so you can run from Devise git master if you want.

Owner

josevalim commented Dec 20, 2011

Actually, we need to validate the e-mail uniqueness. :( So I am caught between a rock and hard place.

@josevalim josevalim closed this in 89db0dd Dec 20, 2011

mrship commented Dec 20, 2011

Sweet, that fixes it for me. Thanks for the swift response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment