diff --git a/services/web/app/src/Features/User/UserEmailsController.js b/services/web/app/src/Features/User/UserEmailsController.js index 7ede21051c..c5c09b3115 100644 --- a/services/web/app/src/Features/User/UserEmailsController.js +++ b/services/web/app/src/Features/User/UserEmailsController.js @@ -1,7 +1,5 @@ let UserEmailsController const AuthenticationController = require('../Authentication/AuthenticationController') -const Features = require('../../infrastructure/Features') -const InstitutionsAPI = require('../Institutions/InstitutionsAPI') const UserGetter = require('./UserGetter') const UserUpdater = require('./UserUpdater') const EmailHelper = require('../Helpers/EmailHelper') @@ -40,13 +38,13 @@ function add(req, res, next) { }) } -async function resendConfirmation(req, res, next) { +function resendConfirmation(req, res, next) { const userId = AuthenticationController.getLoggedInUserId(req) const email = EmailHelper.parseEmail(req.body.email) if (!email) { return res.sendStatus(422) } - UserGetter.getUserByAnyEmail(email, { _id: 1 }, async function(error, user) { + UserGetter.getUserByAnyEmail(email, { _id: 1 }, function(error, user) { if (error) { return next(error) } @@ -57,23 +55,6 @@ async function resendConfirmation(req, res, next) { ) return res.sendStatus(422) } - if (Features.hasFeature('saml') || req.session.samlBeta) { - // institution SSO emails cannot be confirmed by email, - // confirmation happens by linking to the institution - let institution - try { - institution = await InstitutionsAPI.getInstitutionViaDomain( - email.split('@').pop() - ) - } catch (error) { - if (!(error instanceof Errors.NotFoundError)) { - throw error - } - } - if (institution && institution.sso_enabled) { - return res.sendStatus(422) - } - } logger.log({ userId, email }, 'resending email confirmation token') UserEmailsConfirmationHandler.sendConfirmationEmail(userId, email, function( error diff --git a/services/web/test/acceptance/src/helpers/UserHelper.js b/services/web/test/acceptance/src/helpers/UserHelper.js index 775cdf0bfd..944f7cbda5 100644 --- a/services/web/test/acceptance/src/helpers/UserHelper.js +++ b/services/web/test/acceptance/src/helpers/UserHelper.js @@ -158,6 +158,11 @@ module.exports = class UserHelper { if (body.message && body.message.type === 'error') { throw new Error(`register api error: ${body.message.text}`) } + if (body.redir === '/institutional-login') { + throw new Error( + `cannot register intitutional email: ${options.json.email}` + ) + } userHelper.user = await UserGetter.promises.getUser({ email: userData.email })