FIX: Return authenticated=true when reconnecting

This prevents a registration popup on the client
This commit is contained in:
David Taylor 2018-12-11 17:40:02 +00:00
parent 71d8807fec
commit 0f734e2ae2
2 changed files with 2 additions and 0 deletions

View File

@ -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 }

View File

@ -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