如何通过设计更改密码时预先填充当前密码

时间:2016-05-24 11:57:40

标签: ruby-on-rails devise spree-auth-devise

您好我已经提供了以下视图文件

<div class="panel-body">
      <%= form_for @user, :url =>update_change_password_user_path(spree_current_user.id), :method => :put do |f| %>
        <p>
          <%= f.password_field :current_password, class: "form-control"%>
        </p>
        <p>
          <%= f.label :password, Spree.t(:new_password) %><br />
          <%= f.password_field :password, :class => "form-control" %><br />
        </p>
        <p>
          <%= f.label :password_confirmation, Spree.t(:confirm_password) %><br />
          <%= f.password_field :password_confirmation, :class => "form-control" %><br />
        </p>

        <%= f.submit Spree.t(:update), :class => 'btn btn-lg btn-success btn-block' %>
      <% end %>
    </div>

我的要求是预先填写current_password字段,请指导我热门获取用户的current_password。我正在使用gem 'spree_auth_devise', '~> 3.0.0'

1 个答案:

答案 0 :(得分:0)

如果我理解正确,你需要一个占位符 - http://www.w3schools.com/tags/att_input_placeholder.asp,所以它会是: