Merge pull request #1870 from overleaf/spd-invalid-intent-sso

Fix invalid intent errors when logging in with OAuth

GitOrigin-RevId: 20f88a24080b41256bd31b9fb55b68a872ded56b
This commit is contained in:
Simon Detheridge 2019-06-18 16:35:57 +01:00 committed by sharelatex
parent 93386bcb8c
commit ab5b1b6dc4
2 changed files with 9 additions and 0 deletions

View file

@ -19,6 +19,7 @@ const UserSessionsManager = require('./UserSessionsManager')
const ErrorController = require('../Errors/ErrorController') const ErrorController = require('../Errors/ErrorController')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const Errors = require('../Errors/Errors')
const request = require('request') const request = require('request')
const fs = require('fs') const fs = require('fs')
const AuthenticationController = require('../Authentication/AuthenticationController') const AuthenticationController = require('../Authentication/AuthenticationController')
@ -120,6 +121,10 @@ module.exports = UserPagesController = {
settingsPage(req, res, next) { settingsPage(req, res, next) {
const user_id = AuthenticationController.getLoggedInUserId(req) const user_id = AuthenticationController.getLoggedInUserId(req)
const ssoError = req.session.ssoError
if (ssoError) {
delete req.session.ssoError
}
logger.log({ user: user_id }, 'loading settings page') logger.log({ user: user_id }, 'loading settings page')
const shouldAllowEditingDetails = const shouldAllowEditingDetails =
!__guard__( !__guard__(
@ -155,6 +160,7 @@ module.exports = UserPagesController = {
oauthProviders, oauthProviders,
req req
), ),
ssoError: ssoError,
thirdPartyIds: UserPagesController._restructureThirdPartyIds(user), thirdPartyIds: UserPagesController._restructureThirdPartyIds(user),
previewOauth: req.query.prvw != null previewOauth: req.query.prvw != null
}) })

View file

@ -5,6 +5,9 @@ block content
.container .container
.row .row
.col-md-12.col-lg-10.col-lg-offset-1 .col-md-12.col-lg-10.col-lg-offset-1
if ssoError
.alert.alert-danger
| #{translate('sso_link_error')}: #{translate(ssoError)}
.card .card
.page-header .page-header
h1 #{translate("account_settings")} h1 #{translate("account_settings")}