简体   繁体   English

使用Devise Gem保存自定义密码

[英]Custom Password Saving with Devise Gem

I have a form to edit user's profile. 我有一个表格来编辑用户的个人资料。 Im using device gem for login and other stuffs. 我正在使用设备gem进行登录和其他操作。

Thing is i want to make a new custom controller method just to save password.. 我想做一个新的自定义控制器方法只是为了保存密码。

this is so far what i have done 到目前为止,这是我所做的

<%= form_for current_user, url: '/custom_update', html: {class: "form validate-form", novalidate: "novalidate", :multipart => true } do |f| %>
    <div class='form-group'>
        <label>Password</label>
        <%= f.password_field :password, autocomplete: "off", class: "form-control", placeholder: "Leave as blank if you don't want to change password", value: "" %>
    </div>
    <%= f.submit %>
<% end %>

and in controller 并在控制器中

  def set_first_time_password
    p "=============="
    p params
    p "=============="
  end

and the params are coming as such.. that is passwords are shown on server.. its is not coming like password = [FILTERED].. and also how to save this password. 和参数就这样来了..即密码显示在服务器上..它不像密码= [FILTERED] ..以及如何保存此密码。 I have devise gem. 我设计了宝石。 Please help. 请帮忙。 Im new to devise 我是新设计的

This can be done to acheive the goal: 可以达到目标:

@user = current_user
@user.update(params[:user][:password])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM