仅使用omniauth(twitter)登录Devise,Rails 3,Omniauth [英] Using only omniauth (twitter) sign-in with Devise, Rails 3, Omniauth

查看:106
本文介绍了仅使用omniauth(twitter)登录Devise,Rails 3,Omniauth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于Railscasts 209,210,235和236的设置 - Twitter登录是非常好的;不过,我想彻底删除用户在我的应用程序本地创建帐户的功能。换句话说,如果你想登录,你需要使用你的Twitter acct。我只是尽快不管理本地帐户(现在 - 可能会在某些时候添加它)。



我找不到任何可靠的指针如何做到这一点,和Devise路线玩耍,没有取得很好的效果。提前致谢!

解决方案

从评论中复制答案,以从未回答过滤器中删除此问题:


解决这个问题的种类;讨厌的黑客,但它的作品(现在);将它添加到
我的路线:

  devise_for:users,:controllers => {:registrations => registration} do 
get/ users / sign_up=> authentications#index
get/ users / sign_in=> 认证#索引
结束

基本上劫持了Devise表单,并将它们直接发送到
身份验证控制器,如轨道轨道I
中所述。


〜answer per cyrusd


I have a setup based on Railscasts 209, 210, 235 and 236 - Twitter sign-in is working great; however I would like to entirely remove the ability for users to create accounts local to my app. In other words, if you want to sign in, you need to use your Twitter acct. I'd just as soon not bother managing local accounts (for now - may add it back in at some point).

I can't really find any solid pointers to how to do this, and playing around with the Devise routes and such haven't yielded very good results. Thanks in advance!

解决方案

Copying the answer from the comments in order to remove this question from the "Unanswered" filter:

Kind of solved this; nasty hack but it works (for now); added this to my routes:

devise_for :users, :controllers => {:registrations => "registrations"} do
  get "/users/sign_up" => "authentications#index"
  get "/users/sign_in" => "authentications#index"
end

Basically hijacks the Devise forms and sends them directly to the authentications controller, as described in the Railscasts I mentioned...

~ answer per cyrusd

这篇关于仅使用omniauth(twitter)登录Devise,Rails 3,Omniauth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆