【发布时间】:2010-07-27 08:00:10
【问题描述】:
我有一个使用 restful_authentication 插件处理身份验证的 Rails 应用程序。
我在使用电子邮件激活功能时遇到问题,在我处理此问题之前,我希望我的用户无需通过电子邮件激活过程即可注册。
如何禁用电子邮件激活功能。
导轨 2.2.3 Restful_authentication
【问题讨论】:
标签: ruby-on-rails restful-authentication
我有一个使用 restful_authentication 插件处理身份验证的 Rails 应用程序。
我在使用电子邮件激活功能时遇到问题,在我处理此问题之前,我希望我的用户无需通过电子邮件激活过程即可注册。
如何禁用电子邮件激活功能。
导轨 2.2.3 Restful_authentication
【问题讨论】:
标签: ruby-on-rails restful-authentication
在app/models/user_observer.rb,我替换了
UserMailer.deliver_signup_notification(user)
与
user.activate!
到目前为止它对我有用......
【讨论】:
我认为最好的解决方案是重新生成身份验证:
保存来自用户和会话的旧代码(来自模型和控制器,如果您在该文件中编码了某些内容),销毁身份验证并重新生成它
script/destroy authenticated user sessions
script/generate authenticated user sessions
destroy脚本会删除以下文件,如有改动请务必备份。
rm db/migrate/20100520071407_create_users.rb
rm app/views/users/_user_bar.html.erb
rm app/views/users/new.html.erb
rm app/views/sessions/new.html.erb
rm app/helpers/users_helper.rb
rm app/helpers/sessions_helper.rb
rm test/fixtures/users.yml
rm test/unit/user_test.rb
rm test/functional/users_controller_test.rb
rm test/functional/sessions_controller_test.rb
rm config/initializers/site_keys.rb
rm lib/authenticated_test_helper.rb
rm lib/authenticated_system.rb
rm app/controllers/users_controller.rb
rm app/controllers/sessions_controller.rb
rm app/models/user.rb
【讨论】: