fix open id so it creates records properly

This commit is contained in:
Sam 2013-08-23 17:00:01 +10:00
parent 075002a6d5
commit eebe21a8c8
1 changed files with 13 additions and 1 deletions

View File

@ -29,10 +29,22 @@ class Auth::OpenIdAuthenticator < Auth::Authenticator
result.user = user_open_id.try(:user)
result.extra_data = {
openid_url: identity_url
openid_url: identity_url,
# note email may change by the time after_create_account runs
email: email
}
result.email_valid = @opts[:trusted]
result
end
def after_create_account(user, auth)
data = auth[:extra_data]
UserOpenId.create(
user_id: user.id,
url: data[:openid_url],
email: data[:email],
active: true
)
end
end