devise_security_extension:编辑密码/过期/显示视图 [英] devise_security_extension: edit the password/expired/show view

查看:48
本文介绍了devise_security_extension:编辑密码/过期/显示视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用devise_security_extension来在我的应用程序中具有一些密码安全功能。
我在其中一个模型中使用password_expirable,并且当密码过期时,它将进入此视图,并且找不到编辑其内容的方法。您是否有任何建议可以控制该视图的HTML?

I use devise_security_extension in order to have some password security features in my app. I use password_expirable in one of my models, and when the password expires it goes to this view and I find no way to edit its content. Do you have any suggestion how I can control this view's HTML?

推荐答案

当前,gem不会自动为您生成视图编辑。我认为这是人们要求的事情之一。同时,您可以手动创建文件。如果您查看宝石

devise_security_extension / app / views / devise / password_expired / show.html.erb

Currently, the gem will not automatically generate the view for you to edit. I think it's one of the things that people have asked for. In the meantime, you can manually create the file. If you look in the gem's: devise_security_extension/app/views/devise/password_expired/show.html.erb

您将看到gem使用的视图的当前模板。将此文件复制并粘贴到您的 views / devise / password_expired / show.html.erb

You'll see the current template for the view that the gem uses. Copy and paste this file into your views/devise/password_expired/show.html.erb

然后

文件看起来像这样:

<h2>Renew your password</h2>
  <%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %>
  <%= devise_error_messages! %>

  <p><%= f.label :current_password, "Current password" %><br />
  <%= f.password_field :current_password %></p>

  <p><%= f.label :password, "New password" %><br />
  <%= f.password_field :password %></p>

  <p><%= f.label :password_confirmation, "Confirm new password" %><br />
  <%= f.password_field :password_confirmation %></p>

  <p><%= f.submit "Change my password" %></p>
<% end %>

这篇关于devise_security_extension:编辑密码/过期/显示视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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