Merge pull request #3908 from overleaf/jel-reconfirm-ui-meta-tags

Meta tag migration for reconfirm UI

GitOrigin-RevId: b0bda07acc5389b1d5ef4e9ea3d10688ac26f0a0
This commit is contained in:
Alasdair Smith
2021-04-15 02:05:09 +00:00
committed by Copybot
parent d7542e60c3
commit 93492bb25a
3 changed files with 25 additions and 13 deletions
@@ -24,8 +24,8 @@ mixin reconfirmAffiliationNotification(location)
div(ng-if="reconfirm[userEmail.email].reconfirmationSent")
| !{translate("please_check_your_inbox_to_confirm", {institutionName: '{{userEmail.affiliation.institution.name}}'}, ['strong'])}
|  
a(
href
button(
class="btn-inline-link"
ng-click="requestReconfirmation($event, userEmail)"
ng-disabled="ui.isMakingRequest"
) #{translate('resend_confirmation_email')}
@@ -6,6 +6,7 @@ import _ from 'lodash'
*/
import App from '../../../base'
import getMeta from '../../../utils/meta'
export default App.controller('UserAffiliationsController', function(
$scope,
@@ -22,8 +23,8 @@ export default App.controller('UserAffiliationsController', function(
}
$scope.samlBetaSession = ExposedSettings.hasSamlBeta
$scope.samlInitPath = ExposedSettings.samlInitPath
$scope.reconfirmationRemoveEmail = $window.data.reconfirmationRemoveEmail
$scope.reconfirmedViaSAML = $window.data.reconfirmedViaSAML
$scope.reconfirmationRemoveEmail = getMeta('ol-reconfirmationRemoveEmail')
$scope.reconfirmedViaSAML = getMeta('ol-reconfirmedViaSAML')
const LOCAL_AND_DOMAIN_REGEX = /([^@]+)@(.+)/
const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA -Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
@@ -1,19 +1,33 @@
import _ from 'lodash'
import App from '../../../base'
import getMeta from '../../../utils/meta'
export default App.controller('UserAffiliationsReconfirmController', function(
$scope,
UserAffiliationsDataService,
$window
) {
const samlInitPath = ExposedSettings.samlInitPath
$scope.reconfirm = {}
// For portals:
$scope.userEmails = window.data.userEmails
// For settings page:
$scope.ui = $scope.ui || {} // $scope.ui inherited on settings page
$scope.userEmails = getMeta('ol-userEmails')
$scope.reconfirmedViaSAML = getMeta('ol-reconfirmedViaSAML')
// For portals:
const portalAffiliation = getMeta('ol-portalAffiliation')
if (portalAffiliation) {
$scope.portalInReconfirmNotificationPeriod =
portalAffiliation && portalAffiliation.inReconfirmNotificationPeriod
$scope.userEmail = $scope.portalInReconfirmNotificationPeriod // mixin to show notification uses userEmail
}
// For settings page:
$scope.reconfirmationRemoveEmail = getMeta('ol-reconfirmationRemoveEmail')
// For dashboard:
$scope.allInReconfirmNotificationPeriods =
window.data.allInReconfirmNotificationPeriods
$scope.allInReconfirmNotificationPeriods = getMeta(
'ol-allInReconfirmNotificationPeriods'
)
function sendReconfirmEmail(email) {
$scope.ui.hasError = false
@@ -28,9 +42,6 @@ export default App.controller('UserAffiliationsReconfirmController', function(
.finally(() => ($scope.ui.isMakingRequest = false))
}
$scope.reconfirmationRemoveEmail = $window.data.reconfirmationRemoveEmail
$scope.reconfirmedViaSAML = $window.data.reconfirmedViaSAML
$scope.requestReconfirmation = function(obj, userEmail) {
const email = userEmail.email
// For the settings page, disable other parts of affiliation UI
@@ -48,7 +59,7 @@ export default App.controller('UserAffiliationsReconfirmController', function(
])
if (ssoEnabled) {
$window.location.href = `${$scope.samlInitPath}?university_id=${institutionId}&reconfirm=${location}`
$window.location.href = `${samlInitPath}?university_id=${institutionId}&reconfirm=${location}`
} else {
sendReconfirmEmail(email)
}