Ruby on Rails Authlogic gem 和 Password_Reset 不以编辑结尾
我按照这个password_reset教程并且能够让它发挥作用。但有一些我不喜欢的地方我想改变。
我希望在网址中显示
password_reset
而不是reset_passwords
。我通过重命名控制器并将其在config/routes.rb
中路由为map.resources :reset_passwords, :as => 来完成此任务'重置密码', :only => [:index, :create, :edit, :update]
我希望将
domain.com/password_reset
链接到password_reset
页面,而不是domain.com/password_reset/new
我可以通过更改它来做到这一点,以便您输入电子邮件的表单视图不再是“新”而是“索引”。我希望拥有它,这样当用户收到包含
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.
I'd like it to say
password_reset
rather thanreset_passwords
in the url. Which I've managed to accomplish by renaming the controller and routing it inconfig/routes.rb
asmap.resources :reset_passwords, :as => 'reset_password', :only => [:index, :create, :edit, :update]
I'd like to have
domain.com/password_reset
to link to thepassword_reset
page, rather than havingdomain.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".I'd like to have it so when the user is emailed with the
perishable_token
, it gives them a url likedomain.com/password_reset/perishable_token
ordomain.com/verify_password_reset/perishable_token
rather thandomain.com/password_reset/perishable_token/edit
.
Or at the least I'd like to have it asdomain.com/password_reset/perishable_token/verify
I cannot figure out how to get the third one to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了如何将其更改为
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 thandomain.com/password_reset/perishable_token/edit
. I simply took the code from the Edit view and placed it in the Show view.