12626: Copy omniauth info into auth account, not target account.
authorTom Clegg <tclegg@veritasgenetics.com>
Mon, 7 May 2018 19:11:58 +0000 (15:11 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Mon, 7 May 2018 19:11:58 +0000 (15:11 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/api/app/controllers/user_sessions_controller.rb

index 87967a40a5a860a47c34c52d93ae0fcbf38a23fa..20633153e758c70f5b91d0b66466a06e6393b2da 100644 (file)
@@ -46,13 +46,6 @@ class UserSessionsController < ApplicationController
       end
     end
 
-    while (uuid = user.andand.redirect_to_user_uuid)
-      user = User.where(uuid: uuid).first
-      if !user
-        raise Exception.new("identity_url #{omniauth['info']['identity_url']} redirects to nonexistent uuid #{uuid}")
-      end
-    end
-
     if not user
       # New user registration
       user = User.new(:email => omniauth['info']['email'],
@@ -75,6 +68,13 @@ class UserSessionsController < ApplicationController
         # First login to a pre-activated account
         user.identity_url = omniauth['info']['identity_url']
       end
+
+      while (uuid = user.redirect_to_user_uuid)
+        user = User.where(uuid: uuid).first
+        if !user
+          raise Exception.new("identity_url #{omniauth['info']['identity_url']} redirects to nonexistent uuid #{uuid}")
+        end
+      end
     end
 
     # For the benefit of functional and integration tests: