RAILS 3.2 & Devise: email confirmation text box?

I am using Rails 3.2 and Devise. I am wondering if Devise will provide an "Email Confirmation (Address)" field, such as "Password Confirmation", so that the user types in the Password field, and then enter the Password Confirmation field before the website sends an email confirmation will handle registration registration, If not, should I add an email confirmation and check the user model (after rails g devise User)?

Thank you in advance

+4
source share
2 answers

I have not found if devise does what you ask (the question relates to the second: the confirmation_ email field, similar to: password_confirmation, "confirmable", seems to be related exclusively to confirmation links). I had to do this too, and I figured out how to do this using the built-in check of the active record (rails 3.2.8, development 2.1.2):

  • In your model, add confirmation: true to your email check and from :email_confirmation to attr_accessible .
  • In the viewing field, add the field :email_confirmation .

As an example, in your model (without assuming other checks or attr_accessibles):

 attr_accessible :email, :email_confirmation validates :email, confirmation: true 

which will use the built-in active record โ€œconfirmationโ€ of verification (the same as for passwords). Finally, in your views you need to add something like:

 <div><%= f.label :email_confirmation %> <%= f.email_field :email_confirmation %></div> 

There might be a cleaner way, but it worked for me. However, my only development experience so far has been to add it to existing models, I have not used it when creating models for you (presumably this is basically the same).

+11
source

Assuming you have pearls installed when you perform this function:

 rails generate devise:install 

It will generate your migration file, which will store your email related materials that you will need to find in the direction you are talking about. All you have to do is not to comment on this. Otherwise, I will comment on everything else that I do not need.

The module you refer to is called confirmation.

Assuming you haven't found this yet, this link will explain the rest:

How to set up email confirmation using Devise?

-3
source

All Articles