From ab5b1b6dc4db6b9a7a096d54f5aec515e9293779 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Tue, 18 Jun 2019 16:35:57 +0100 Subject: [PATCH] Merge pull request #1870 from overleaf/spd-invalid-intent-sso Fix invalid intent errors when logging in with OAuth GitOrigin-RevId: 20f88a24080b41256bd31b9fb55b68a872ded56b --- services/web/app/src/Features/User/UserPagesController.js | 6 ++++++ services/web/app/views/user/settings.pug | 3 +++ 2 files changed, 9 insertions(+) diff --git a/services/web/app/src/Features/User/UserPagesController.js b/services/web/app/src/Features/User/UserPagesController.js index 3bfc47d530..748fd7a00a 100644 --- a/services/web/app/src/Features/User/UserPagesController.js +++ b/services/web/app/src/Features/User/UserPagesController.js @@ -19,6 +19,7 @@ const UserSessionsManager = require('./UserSessionsManager') const ErrorController = require('../Errors/ErrorController') const logger = require('logger-sharelatex') const Settings = require('settings-sharelatex') +const Errors = require('../Errors/Errors') const request = require('request') const fs = require('fs') const AuthenticationController = require('../Authentication/AuthenticationController') @@ -120,6 +121,10 @@ module.exports = UserPagesController = { settingsPage(req, res, next) { 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') const shouldAllowEditingDetails = !__guard__( @@ -155,6 +160,7 @@ module.exports = UserPagesController = { oauthProviders, req ), + ssoError: ssoError, thirdPartyIds: UserPagesController._restructureThirdPartyIds(user), previewOauth: req.query.prvw != null }) diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index d75549f2cb..de7b3ff1d5 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -5,6 +5,9 @@ block content .container .row .col-md-12.col-lg-10.col-lg-offset-1 + if ssoError + .alert.alert-danger + | #{translate('sso_link_error')}: #{translate(ssoError)} .card .page-header h1 #{translate("account_settings")}