mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-15 08:56:57 +00:00
Adding an institution email that must be linked
GitOrigin-RevId: 9ba42a07fb386275cf6d81a7d4b91a7f974faf15
This commit is contained in:
parent
ae423b5800
commit
5c918bed94
6 changed files with 47 additions and 10 deletions
|
@ -144,7 +144,6 @@ const UserPagesController = {
|
|||
req
|
||||
),
|
||||
oauthUseV2: Settings.oauthUseV2 || false,
|
||||
samlInitPath: _.get(Settings, ['saml', 'ukamf', 'initPath']),
|
||||
institutionLinked,
|
||||
institutionNotLinked,
|
||||
samlBeta: req.session.samlBeta,
|
||||
|
|
|
@ -38,6 +38,7 @@ const Path = require('path')
|
|||
const Features = require('./Features')
|
||||
Modules = require('./Modules')
|
||||
const moment = require('moment')
|
||||
const lodash = require('lodash')
|
||||
|
||||
const jsPath = Settings.useMinifiedJs ? '/minjs/' : '/js/'
|
||||
|
||||
|
@ -529,6 +530,8 @@ module.exports = function(app, webRouter, privateApiRouter, publicApiRouter) {
|
|||
res.locals.ExposedSettings = {
|
||||
isOverleaf: Settings.overleaf != null,
|
||||
appName: Settings.appName,
|
||||
hasSamlFeature: Features.hasFeature('saml'),
|
||||
samlInitPath: lodash.get(Settings, ['saml', 'ukamf', 'initPath']),
|
||||
siteUrl: Settings.siteUrl,
|
||||
recaptchaSiteKeyV3:
|
||||
Settings.recaptcha != null ? Settings.recaptcha.siteKeyV3 : undefined,
|
||||
|
|
|
@ -291,5 +291,4 @@ block content
|
|||
span(ng-show="state.inflight") #{translate("deleting")}...
|
||||
|
||||
script(type='text/javascript').
|
||||
window.passwordStrengthOptions = !{StringHelper.stringifyJsonForScript(settings.passwordStrengthOptions || {})}
|
||||
window.samlInitPath = '#{samlInitPath}';
|
||||
window.passwordStrengthOptions = !{StringHelper.stringifyJsonForScript(settings.passwordStrengthOptions || {})}
|
|
@ -1,3 +1,6 @@
|
|||
mixin aboutInstitutionLink()
|
||||
a(href="/") #{translate("find_out_more_about_institution_login")}.
|
||||
|
||||
form.row(
|
||||
ng-controller="UserAffiliationsController"
|
||||
name="affiliationsForm"
|
||||
|
@ -19,12 +22,12 @@ form.row(
|
|||
| {{ userEmail.email + (userEmail.default ? ' (primary)' : '') }}
|
||||
div(ng-if="!userEmail.confirmedAt").small
|
||||
strong #{translate('unconfirmed')}.
|
||||
span(ng-if="!userEmail.affiliation.institution.ssoEnabled") #{translate('please_check_your_inbox')}.
|
||||
span(ng-if="!hasSamlFeature || (hasSamlFeature && !userEmail.affiliation.institution.ssoEnabled)") #{translate('please_check_your_inbox')}.
|
||||
br
|
||||
a(
|
||||
href,
|
||||
ng-click="resendConfirmationEmail(userEmail)",
|
||||
ng-if="!userEmail.affiliation.institution.ssoEnabled"
|
||||
ng-if="!hasSamlFeature || (hasSamlFeature && !userEmail.affiliation.institution.ssoEnabled)"
|
||||
) #{translate('resend_confirmation_email')}
|
||||
div(ng-if="userEmail.confirmedAt && userEmail.affiliation.institution && userEmail.affiliation.institution.confirmed && userEmail.affiliation.institution.licence != 'free'").small
|
||||
span.label.label-primary #{translate("professional")}
|
||||
|
@ -105,7 +108,7 @@ form.row(
|
|||
| !{translate("can_link_your_institution_acct", {institutionName: '{{userEmail.affiliation.institution.name}}'})}
|
||||
p.small
|
||||
| !{translate("doing_this_allow_log_in_through_institution")}
|
||||
a(href="/") #{translate("find_out_more_about_institution_login")}
|
||||
+aboutInstitutionLink()
|
||||
td.with-border.affiliations-table-inline-actions(ng-if="!userEmail.samlProviderId && !institutionAlreadyLinked(userEmail)")
|
||||
button.btn-sm.btn.btn-info(ng-click="linkInstitutionAcct(userEmail.email, userEmail.affiliation.institution.id)" ng-disabled="ui.isMakingRequest")
|
||||
| #{translate("link_accounts")}
|
||||
|
@ -134,7 +137,20 @@ form.row(
|
|||
input-type="email"
|
||||
input-required="true"
|
||||
)
|
||||
td
|
||||
if hasFeature('saml')
|
||||
td(
|
||||
colspan="2"
|
||||
ng-if="newAffiliation && newAffiliation.university && newAffiliation.university.ssoEnabled"
|
||||
)
|
||||
p.affiliations-table-label {{ newAffiliation.university.name }}
|
||||
p !{translate("to_add_email_accounts_need_to_be_linked", {institutionName: "{{newAffiliation.university.name}}"})}
|
||||
p !{translate("doing_this_will_verify_affiliation_and_allow_log_in", {institutionName: "{{newAffiliation.university.name}}"})}
|
||||
+aboutInstitutionLink()
|
||||
button.btn-sm.btn.btn-primary.btn-link-accounts(ng-click="linkInstitutionAcct(newAffiliation.email, newAffiliation.university.id)" ng-disabled="ui.isMakingRequest")
|
||||
| #{translate("link_accounts_and_add_email")}
|
||||
td(
|
||||
ng-if="shouldShowRolesAndAddEmailButton()"
|
||||
)
|
||||
p.affiliations-table-label(
|
||||
ng-if="newAffiliation.university && !ui.showManualUniversitySelectionUI"
|
||||
)
|
||||
|
@ -163,7 +179,9 @@ form.row(
|
|||
show-university-and-country="ui.showManualUniversitySelectionUI"
|
||||
show-role-and-department="ui.isValidEmail && newAffiliation.university"
|
||||
)
|
||||
td
|
||||
td(
|
||||
ng-if="shouldShowRolesAndAddEmailButton()"
|
||||
)
|
||||
button.btn.btn-sm.btn-primary(
|
||||
ng-disabled="affiliationsForm.$invalid || ui.isMakingRequest"
|
||||
ng-click="addNewEmail()"
|
||||
|
|
|
@ -28,7 +28,21 @@ define(['base'], App =>
|
|||
$scope.closeInstitutionNotification = type => {
|
||||
$scope.hideInstitutionNotifications[type] = true
|
||||
}
|
||||
|
||||
$scope.hasSamlFeature = ExposedSettings.hasSamlFeature
|
||||
$scope.samlInitPath = ExposedSettings.samlInitPath
|
||||
$scope.shouldShowRolesAndAddEmailButton = () => {
|
||||
const newAffiliation = $scope.newAffiliation
|
||||
const hasSamlFeature = $scope.hasSamlFeature
|
||||
return (
|
||||
!newAffiliation ||
|
||||
(newAffiliation && !newAffiliation.university) ||
|
||||
(!hasSamlFeature && newAffiliation && newAffiliation.university) ||
|
||||
(hasSamlFeature &&
|
||||
newAffiliation &&
|
||||
newAffiliation.university &&
|
||||
!newAffiliation.university.ssoEnabled)
|
||||
)
|
||||
}
|
||||
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,}))$/
|
||||
|
||||
|
@ -91,7 +105,7 @@ define(['base'], App =>
|
|||
$scope.ui.isMakingRequest = true
|
||||
$scope.ui.isProcessing = true
|
||||
$window.location.href = `${
|
||||
window.samlInitPath
|
||||
$scope.samlInitPath
|
||||
}?university_id=${institutionId}&auto=true&email=${email}`
|
||||
}
|
||||
|
||||
|
|
|
@ -96,3 +96,7 @@ tbody > tr.affiliations-table-warning-row > td {
|
|||
.affiliations-table-label {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.btn-link-accounts {
|
||||
margin-bottom: (@line-height-computed / 2) - @table-cell-padding;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue