Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
find user and add preferences to session, refs #87
Browse files Browse the repository at this point in the history
  • Loading branch information
obfuscurity committed May 12, 2013
1 parent a496c43 commit 38d58b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/descartes/routes/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ def google_callback
user = env['omniauth.auth']['info']
email = user['email'].is_a?(Array) ? user['email'].first : user['email']
email = email.downcase

session['user'] = {
'identity_url' => env['omniauth.auth']['uid'],
'email' => email,
'first_name' => user['first_name'],
'last_name' => user['last_name']
'last_name' => user['last_name'],
'preferences' => User.find_or_create_by_email(:email => email).preferences
}
end
redirect redirect_to || '/'
Expand Down

0 comments on commit 38d58b7

Please sign in to comment.