Merge pull request #2167 from overleaf/jel-saml-account-settings-layout

Account settings layout for institution SSO

GitOrigin-RevId: d9c9e5eeb3b4a215456b0f5294139c1b8d4968c3
This commit is contained in:
Eric Mc Sween
2019-09-30 13:36:41 +00:00
committed by sharelatex
parent 16ac5126cb
commit 039b5eaba0
8 changed files with 309 additions and 124 deletions
@@ -4,6 +4,7 @@ const ErrorController = require('../Errors/ErrorController')
const logger = require('logger-sharelatex')
const Settings = require('settings-sharelatex')
const AuthenticationController = require('../Authentication/AuthenticationController')
const _ = require('lodash')
const UserPagesController = {
registerPage(req, res) {
@@ -106,10 +107,15 @@ const UserPagesController = {
settingsPage(req, res, next) {
const userId = AuthenticationController.getLoggedInUserId(req)
// SSO
const ssoError = req.session.ssoError
if (ssoError) {
delete req.session.ssoError
}
// Institution SSO
const institutionLinked = _.get(req.session, ['saml', 'linked'])
const institutionNotLinked = _.get(req.session, ['saml', 'notLinked'])
delete req.session.saml
logger.log({ user: userId }, 'loading settings page')
let shouldAllowEditingDetails = true
if (Settings.ldap && Settings.ldap.updateUserDetailsOnLogin) {
@@ -136,9 +142,11 @@ const UserPagesController = {
req
),
oauthUseV2: Settings.oauthUseV2 || false,
samlInitPath: _.get(Settings, ['saml', 'ukamf', 'initPath']),
institutionLinked,
institutionNotLinked,
ssoError: ssoError,
thirdPartyIds: UserPagesController._restructureThirdPartyIds(user),
previewOauth: req.query.prvw != null
thirdPartyIds: UserPagesController._restructureThirdPartyIds(user)
})
})
},