0
我正在嘗試構建自定義重置密碼功能。 我有一個表單上我的看法在設計用戶上更改密碼
<div class="form-group">
<%= f.label :password %>
<%= f.password_field :password, autofocus: true, title:"Enter your email", name:"password", id:"password", class:"form-control" %>
<span class="help-block small">Password</span>
</div>
<div class="form-group">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation, autofocus: true, title:"Enter your email", name:"password_confirmation", id:"password_confirmation", class:"form-control" %>
<span class="help-block small">Confirm Password</span>
</div>
<div class="actions"><%= f.submit "Update Password", class:"btn btn-success btn-block" %></div>
然後我控制器上我試圖更改密碼和password_confirmation領域。
@user.update_attributes({:password => params[:password], :password_confirmation => params[:password_confirmation]})
它似乎密碼正在改變,但當我試圖登錄我不能!
請發佈完整的erb代碼片段,包括<%= form_for標記 – Phil