Rails, Authlogic without password (registration ok

2020-04-19 06:43发布

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条回答
Bombasti
2楼-- · 2020-04-19 07:36

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!

查看更多
登录 后发表回答