Rails, Authlogic without password (registration ok. user_session validation fails)

青春壹個敷衍的年華 提交于 2020-01-11 12:09:32

问题


I am trying to skip the password for Users in Authlogic..

Thanks to SO, I found a solution for creating users

 User
 acts_as_authentic do |c|
   c.validate_password_field = false
   c.validate_email_field = false
 end

The User_session is still giving a problem - any time I try to log in I get "password cannot be blank"..

how to bypass validation on user session?


回答1:


Actually found it here:

Using Authlogic to authenticate with only a username

Just pass a user object instead of login/password

UserSession.new(User.find_by_username('Shreyas Satish')) (This works with rails 3 and authlogic 2.1.6)

Thanks to fantactuka!



来源:https://stackoverflow.com/questions/8496580/rails-authlogic-without-password-registration-ok-user-session-validation-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!