using authlogic to auto create users bypassing explicit user registeration

折月煮酒 提交于 2020-01-01 17:06:12

问题


I'm wondering how to go about using Authlogic to auto register a user who chooses to use open id. Right now they have to register first before being able to login in, even if they choose open id, but I'd prefer if they could just login directly provided I get all the necessary details from the open id provider. But I'm not sure how to go about doing this?

Would I do it inside my user session controller or is there some fancy way to extend authlogic inside the model?

If someone could point me in the right the direction, i'd be grateful.

Here's an example of what I have now with the two pages:

http://morning-warrior-55.heroku.com/

Thanks,


回答1:


Gaizka's version seems to work beautifully for me.

http://github.com/gaizka/authlogic_openid

Thanks, here's the example of it working:

http://big-glow-mama.heroku.com/

http://github.com/holden/authlogic_openid_selector_example/tree/with-facebook/




回答2:


You have to use auto_register method in your UserSession model. Although i did try to solve the very same question. I succeeded with first time login/registration only.

Second time when user tries to login, the system tries to register it again.



来源:https://stackoverflow.com/questions/1476953/using-authlogic-to-auto-create-users-bypassing-explicit-user-registeration

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