查看
在我的应用中,使用devise gem用户可以使用错误的密码编辑表单,将显示错误消息并显示表单
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
- devise_error_messages!
.form-horizontal
.form-group
= f.label :email, :class => "col-sm-4 control-label"
.col-sm-5
= f.email_field :email, autofocus: true, :class => "form-control"
.minimum-password
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
%div
Currently waiting confirmation for: #{resource.unconfirmed_email}
.form-group
= f.label :password, :class => "col-sm-4 control-label"
.col-sm-5
= f.password_field :password, autocomplete: "off", :class => "form-control"
%i.pull-right
(leave blank if you don't want to change it)
.form-group
= f.label :password_confirmation, :class => "col-sm-4 control-label"
.col-sm-5
= f.password_field :password_confirmation, autocomplete: "off", :class => "form-control"
.form-group
= f.label :current_password, :class => "col-sm-4 control-label"
.col-sm-5
= f.password_field :current_password, autocomplete: "off", :class => "form-control"
.center-align
.actions
= f.submit "Update",:class => " btn btn-primary"
%br/
= link_to "Back", :back