# in views/device/registration/new.html.erb:
<% password = Devise.friendly_token.first(8) %>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name, :locale => I18n.locale)) do |f| %>
<%= f.hidden_field :password, :value => password %>
<%= f.hidden_field :password_confirmation, :value => password %>
<%= f.email_field :email %>
<%= f.submit "sign up" %>
<% end %>
# in views/device/mailer/confirmation_instructions.html.erb:
<p>Your Password: <%# @ressource.password %></p>
我正在为新用户生成密码。用户会收到一封确认电子邮件,这应该是放置生成密码的正确位置。(确认后可以将密码发送给他)
但在电子邮件中@resource.password 为零!
如何在设备确认电子邮件中发送给定的密码?替代方法可能是将密码存储在数据库中而不加密,但我也没有成功。