fix login bug
authorTom Clegg <tom@clinicalfuture.com>
Fri, 1 Feb 2013 06:09:22 +0000 (22:09 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Fri, 1 Feb 2013 06:09:22 +0000 (22:09 -0800)
app/controllers/user_sessions_controller.rb

index 1e61392f5f85beb856a3f70900af28d0595b75f1..28e7e795cd83307f66a32f2a130016dea8dfcc9a 100644 (file)
@@ -29,16 +29,18 @@ class UserSessionsController < ApplicationController
                       :first_name => omniauth['info']['first_name'],
                       :last_name => omniauth['info']['last_name'],
                       :identity_url => omniauth['info']['identity_url'])
-      Thread.current[:user] = user # prevents OrvosModel#before_create
-                                   # from throwing "unauthorized"
-      user.save!
     else
       user.email = omniauth['info']['email']
       user.first_name = omniauth['info']['first_name']
       user.last_name = omniauth['info']['last_name']
-      user.save
     end
 
+    # prevent OrvosModel#before_create and _update from throwing
+    # "unauthorized":
+    Thread.current[:user] = user
+
+    user.save!
+
     omniauth.delete('extra')
 
     # Give the authenticated user a cookie for direct API access