Ruby on Rails Authlogic gem 和 Password_Reset 不以编辑结尾

发布于 2024-09-16 15:23:04 字数 1007 浏览 9 评论 0原文

我按照这个password_reset教程并且能够让它发挥作用。但有一些我不喜欢的地方我想改变。

  1. 我希望在网址中显示 password_reset 而不是 reset_passwords。我通过重命名控制器并将其在 config/routes.rb 中路由为 map.resources :reset_passwords, :as => 来完成此任务'重置密码', :only => [:index, :create, :edit, :update]

  2. 我希望将 domain.com/password_reset 链接到 password_reset页面,而不是 domain.com/password_reset/new
    我可以通过更改它来做到这一点,以便您输入电子邮件的表单视图不再是“新”而是“索引”。

  3. 我希望拥有它,这样当用户收到包含 perishable_token 的电子邮件时,它会为他们提供一个类似于 domain.com/password_reset/perishable_token的网址>domain.com/verify_password_reset/perishable_token 而不是 domain.com/password_reset/perishable_token/edit
    或者至少我希望将其设置为 domain.com/password_reset/perishable_token/verify

我不知道如何让第三个工作。

I followed this password_reset tutorial and was able to get it working. But there are a few things I don't like about it that I want to change.

  1. I'd like it to say password_reset rather than reset_passwords in the url. Which I've managed to accomplish by renaming the controller and routing it in config/routes.rb as map.resources :reset_passwords, :as => 'reset_password', :only => [:index, :create, :edit, :update]

  2. I'd like to have domain.com/password_reset to link to the password_reset page, rather than having domain.com/password_reset/new
    I was able to do this by changing it so that the view with the form where you enter your email is no longer "new" but "index".

  3. I'd like to have it so when the user is emailed with the perishable_token, it gives them a url like domain.com/password_reset/perishable_token or domain.com/verify_password_reset/perishable_token rather than domain.com/password_reset/perishable_token/edit.
    Or at the least I'd like to have it as domain.com/password_reset/perishable_token/verify

I cannot figure out how to get the third one to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余厌 2024-09-23 15:23:04

我想出了如何将其更改为 domain.com/password_reset/perishable_token 而不是 domain.com/password_reset/perishable_token/edit。我只是从“编辑”视图中获取代码并将其放置在“显示”视图中。

I figured out how to change it to domain.com/password_reset/perishable_token rather than domain.com/password_reset/perishable_token/edit. I simply took the code from the Edit view and placed it in the Show view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文