Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/omniauth/strategies/windowslive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ class Windowslive < OmniAuth::Strategies::OAuth2
info do
{
'id' => raw_info['id'],
'emails' => emails_parser,
'name' => raw_info['name'],
'first_name' => raw_info['first_name'],
'last_name' => raw_info['last_name'],
'gender' => raw_info['gender'],
'link' => raw_info['link'],
'locale' => raw_info['locale'],
'updated_time' => raw_info['updated_time']
}
}.merge(self.emails_parser)
end

extra do
Expand Down Expand Up @@ -65,14 +64,16 @@ def build_access_token
def emails_parser
emails = raw_info['emails']
emails_parsed = []
email = nil

if emails
if emails['preferred']
emails_parsed << { 'value' => emails['preferred'], 'type' => 'preferred', 'primary' => true }
end

if emails['account']
emails_parsed << { 'value' => emails['account'], 'type' => 'account' }
email = emails['account']
emails_parsed << { 'value' => email, 'type' => 'account' }
end

if emails['personal']
Expand All @@ -87,8 +88,7 @@ def emails_parser
emails_parsed << { 'value' => emails['other'], 'type' => 'other' }
end
end

emails_parsed
{ 'emails' => emails_parsed, 'email' => email }
end
end
end
Expand Down