我的设计/omniauth 在我的开发模式下工作(经过 3.5 年的尝试设置)。
当我推送到生产环境并尝试登录时,我收到一条错误消息,内容如下:
app/models/user.rb:159:in `find_for_oauth'
2016-06-26T00:24:21.173282+00:00 app[web.1]:
2016-06-26T00:24:21.173264+00:00 app[web.1]:
2016-06-26T00:24:21.173279+00:00 app[web.1]: Net::SMTPFatalError (553-5.1.2 The recipient address <change@me-114727432687651490566-google_oauth2.c
我的用户模型的第 159 行有:
user.save!
该行是方法中的最后一步之一:
def self.find_for_oauth(auth, signed_in_resource = nil)
# Get the identity and user if they exist
identity = Identity.find_for_oauth(auth)
# If a signed_in_resource is provided it always overrides the existing user
# to prevent the identity being locked with accidentally created accounts.
# Note that this may leave zombie accounts (with no associated identity) which
# can be cleaned up at a later date.
user = signed_in_resource ? signed_in_resource : identity.user
# p '11111'
# Create the user if needed
if user.nil?
# p 22222
# Get the existing user by email if the provider gives us a verified email.
# If no verified email was provided we assign a temporary email and ask the
# user to verify it on the next step via UsersController.finish_signup
email_is_verified = auth.info.email && (auth.info.verified || auth.info.verified_email)
email = auth.info.email if email_is_verified # take out this if stmt for chin yi's solution
user = User.where(:email => email).first if email
# Create the user if it's a new registration
if user.nil?
# p 33333
user = User.new(
# at least one problem with this is that each provider uses different terms to desribe first name/last name/email. See notes on linkedin above
first_name: auth.info.first_name,
last_name: auth.info.last_name,
email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
#username: auth.info.nickname || auth.uid,
password: Devise.friendly_token[0,20])
# fallback for name fields - add nickname to user table
# debugger
if email_is_verified
user.skip_confirmation!
end
# user.skip_confirmation!
user.save!
end
end
# Associate the identity with the user if needed
if identity.user != user
identity.user = user
identity.save!
end
user
end
谁能看到我需要做些什么才能使这项工作在生产模式下工作?