https://github.com/arunagw/omniauth-twitter>omniauth-twitter
问题是,前线发送者没有发出电子邮件,因此,我申请的模型用户证实存在电子邮件,我在回击中发现以下错误:
Email can t be blank
我可在user.rb上查阅。 模式:
#config omniauth twitter
def self.find_for_twitter_oauth(access_token, signed_in_resource = nil)
data = access_token.extra.raw_info
if user = User.where(:username => data.screen_name).first
user
else
User.create!(:username => data.screen_name, :password => Devise.friendly_token)
end
end
我在omniauth_questbacks_ Controller.rb上也这样做。
def twitter
@user = User.find_for_twitter_oauth(request.env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Twitter"
sign_in_and_redirect @user, :event => :authentication
else
# http://stackoverflow.com/questions/7117200/devise-for-twitter-cookie-overflow-error
session["devise.twitter_data"] = request.env["omniauth.auth"].except( extra )
redirect_to new_user_registration_url
end
end
我想迫使用户提供电子邮件地址,以便发送通讯、信使......
www.un.org/spanish/ecosoc 我如何解决这一问题?
谢谢!