开发者

Devise, twitter - ask for confirmation email

开发者 https://www.devze.com 2023-04-05 07:12 出处:网络
I have implemented twitter authentication with devise using something very similar to this: https://github.com/plataformatec/devise/wiki开发者_运维知识库/OmniAuth:-Overview

I have implemented twitter authentication with devise using something very similar to this: https://github.com/plataformatec/devise/wiki开发者_运维知识库/OmniAuth:-Overview

My question is, since twitter doesn't give you the email of the user, how can you direct the user back to the flow of:

  1. User signs in with twitter
  2. User is presented with an email form
  3. User needs to confirm his/her email
  4. clicking confirmation link sends user to site logged in

Devise pretty much takes care with #3 and #4. How should I structure my code to allow #2 to transit into #3 and #4?

Thanks!


Show new user form in twitter callback page. Store twitter token in hidden field. Then you can create new user in your controller and do what you want with the twitter token. User.create also sends confirmation email.

User.create(:email => params[:email], :password => params[:password], :password_confirmation => params[:password_confirmation])


Ryan Bates covers most of this in his screencast OmniAuth Part 2, to get the email confirmation all you need to do is add the confirmable option to devise.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号