From 0f734e2ae28caabca2d1fb5b17f5bfc0cdf6b4f4 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 11 Dec 2018 17:40:02 +0000 Subject: [PATCH] FIX: Return authenticated=true when reconnecting This prevents a registration popup on the client --- app/controllers/users/omniauth_callbacks_controller.rb | 1 + spec/requests/omniauth_callbacks_controller_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index b34e751f121..60bb2294ef3 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -32,6 +32,7 @@ class Users::OmniauthCallbacksController < ApplicationController cookies.delete('fsl') return redirect_to Discourse.base_uri("/my/preferences/account") else + @auth_result.authenticated = true return respond_to do |format| format.html format.json { render json: @auth_result.to_client_hash } diff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rb index 97bd64bb420..d4b424344e7 100644 --- a/spec/requests/omniauth_callbacks_controller_spec.rb +++ b/spec/requests/omniauth_callbacks_controller_spec.rb @@ -412,6 +412,7 @@ RSpec.describe Users::OmniauthCallbacksController do OmniAuth.config.mock_auth[:google_oauth2].uid = "123456" get "/auth/google_oauth2/callback.json" expect(response.status).to eq(200) + expect(JSON.parse(response.body)["authenticated"]).to eq(true) expect(session[:current_user_id]).to eq(user.id) expect(GoogleUserInfo.count).to eq(1) end