Merge pull request #1895 from overleaf/jel-oauth-db-flip

Add setting var for OAuth data source

GitOrigin-RevId: e8a2ce588c7b5c8a9cf2c782d0434b421df7b356
This commit is contained in:
Simon Detheridge 2019-06-25 12:08:24 +01:00 committed by sharelatex
parent aa5f45e128
commit bd3f59c22a
3 changed files with 10 additions and 8 deletions

View file

@ -160,6 +160,7 @@ module.exports = UserPagesController = {
oauthProviders,
req
),
oauthUseV2: Settings.oauthUseV2 || false,
ssoError: ssoError,
thirdPartyIds: UserPagesController._restructureThirdPartyIds(user),
previewOauth: req.query.prvw != null

View file

@ -1,6 +1,6 @@
block scripts
script(type='text/javascript').
window.oauthFallback = #{oauthFallback}
window.oauthUseV2 = #{oauthUseV2}
window.oauthProviders = !{StringHelper.stringifyJsonForScript(oauthProviders)}
window.thirdPartyIds = !{StringHelper.stringifyJsonForScript(thirdPartyIds)}
@ -45,7 +45,7 @@ mixin providerList()
h3.text-capitalize#linked-accounts #{translate("linked_accounts")}
p.small #{translate("linked_accounts_explained", {appName:'{{settings.appName}}'})}
if settings.oauthFallback
if !settings.oauthUseV2
div.text-center(ng-if="ui.isLoadingV1Ids")
i.fa.fa-fw.fa-spin.fa-refresh(aria-hidden="true")
|  #{translate("loading")}...

View file

@ -30,11 +30,12 @@ define(['base'], App =>
}
$scope.providers = window.oauthProviders
$scope.thirdPartyIds = window.thirdPartyIds
// $scope.v2ThirdPartyIds can be removed post user-c11n
// until v1 is authoritative we will use v1 SSO data for providers
// except collabratec, which will only write to v2.
// post user-c11n, oauthFallback setting will be removed and
// we will only use data from v2
// until oauthUseV2=true, we will use OAuth data via v1 DB,
// except for Collabratec, which is only writing to the v2 DB.
// $scope.v2ThirdPartyIds is required for Collabratec,
// and only until v2 is authoritative. Though, we should leave this
// until we stop double writes, in case we need to flip.
// Double writes for OAuth will stop when oauthFallback=false
$scope.v2ThirdPartyIds = window.thirdPartyIds
}
const _getUserV1OauthProviders = () => {
@ -84,7 +85,7 @@ define(['base'], App =>
}
_reset()
if (window.oauthFallback) {
if (!window.oauthUseV2) {
_getUserV1OauthProviders()
}
}