停止对设计的当前密码要求 [英] Stop Current Password Requirement for Devise

查看:56
本文介绍了停止对设计的当前密码要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站的编辑用户部分有问题.出于某种原因,我在尝试编辑用户时不断收到错误当前密码不能为空".我们使用 devise 来管理用户,但我似乎无法在任何地方找到会产生此错误的代码.

I'm having an issue with the edit user section of my site. For some reason I keep getting the error "Current password can't be blank" when trying to edit a user. We use devise to manage users, but I can't seem to find code anywhere that would generate this error.

这是表格的代码:

- semantic_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |form|
    = devise_error_messages!
    = form.semantic_errors
    = form.input :first
    = form.input :last
    = form.input :birth_year, as: :select, collection: User.birth_range.to_a.reverse
    %i= t('users.edit.cast_biometrics_hint')
    = form.input :gender, as: :select, collection: gender_options, include_blank: false
    = form.input :eye_color, as: :select, collection: eye_color_options, required: false
    = form.input :hair_color, as: :select, collection: hair_color_options, required: false
    = form.input :ethnicity, as: :select, collection: ethnicity_options, required: false
    %li.select.optional#user_height_input
      %label{for: 'user_height'} Height
      %select#user_height_ft{name: 'user[height_ft]'}
        = options_for_select 0..9, resource.height_ft
      %span ft  
      %select#user_height_in{name: 'user[height_in]'}
        = options_for_select 0..11, resource.height_in
      %span in
    = form.buttons

推荐答案

devise wiki 中有更多关于此的信息.https://github.com/plataformatec/devise/wiki/How-To%3a-Allow-users-to-edit-their-account-without-providing-a-password

There is more info in the devise wiki about this. https://github.com/plataformatec/devise/wiki/How-To%3a-Allow-users-to-edit-their-account-without-providing-a-password

这篇关于停止对设计的当前密码要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆