mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3755 from overleaf/jpa-xss-2
[views] mitigate Angular XSS via email/new_email GitOrigin-RevId: 3d127c283ba9f97c5b0e6c53a9d77f7f597058bb
This commit is contained in:
parent
7609b741fa
commit
f353728bda
5 changed files with 18 additions and 19 deletions
|
@ -22,7 +22,6 @@ const UserPagesController = {
|
||||||
title: 'register',
|
title: 'register',
|
||||||
sharedProjectData,
|
sharedProjectData,
|
||||||
newTemplateData,
|
newTemplateData,
|
||||||
new_email: req.query.new_email || '',
|
|
||||||
samlBeta: req.session.samlBeta
|
samlBeta: req.session.samlBeta
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -37,8 +36,7 @@ const UserPagesController = {
|
||||||
AuthenticationController.setRedirectInSession(req, req.query.redir)
|
AuthenticationController.setRedirectInSession(req, req.query.redir)
|
||||||
}
|
}
|
||||||
res.render('user/login', {
|
res.render('user/login', {
|
||||||
title: 'login',
|
title: 'login'
|
||||||
email: req.query.email
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ block content
|
||||||
placeholder='email@example.com',
|
placeholder='email@example.com',
|
||||||
ng-model="email",
|
ng-model="email",
|
||||||
ng-model-options="{ updateOn: 'blur' }",
|
ng-model-options="{ updateOn: 'blur' }",
|
||||||
ng-init="email = "+JSON.stringify(email),
|
|
||||||
focus="true"
|
focus="true"
|
||||||
)
|
)
|
||||||
span.small.text-primary(ng-show="loginForm.email.$invalid && loginForm.email.$dirty")
|
span.small.text-primary(ng-show="loginForm.email.$invalid && loginForm.email.$dirty")
|
||||||
|
|
|
@ -22,7 +22,7 @@ block content
|
||||||
form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate)
|
form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate)
|
||||||
input(type="hidden", name="_csrf", value=csrfToken)
|
input(type="hidden", name="_csrf", value=csrfToken)
|
||||||
if !hasFeature('affiliations')
|
if !hasFeature('affiliations')
|
||||||
if !externalAuthenticationSystemUsed()
|
if !externalAuthenticationSystemUsed()
|
||||||
.form-group
|
.form-group
|
||||||
label(for='email') #{translate("email")}
|
label(for='email') #{translate("email")}
|
||||||
input.form-control(
|
input.form-control(
|
||||||
|
@ -32,7 +32,6 @@ block content
|
||||||
placeholder="email@example.com"
|
placeholder="email@example.com"
|
||||||
required,
|
required,
|
||||||
ng-model="email",
|
ng-model="email",
|
||||||
ng-init="email = "+JSON.stringify(user.email),
|
|
||||||
ng-model-options="{ updateOn: 'blur' }"
|
ng-model-options="{ updateOn: 'blur' }"
|
||||||
)
|
)
|
||||||
span.small.text-danger(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty")
|
span.small.text-danger(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty")
|
||||||
|
@ -130,7 +129,7 @@ block content
|
||||||
required,
|
required,
|
||||||
complex-password
|
complex-password
|
||||||
)
|
)
|
||||||
span.small.text-danger(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage" aria-live="polite")
|
span.small.text-danger(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage" aria-live="polite")
|
||||||
.form-group
|
.form-group
|
||||||
label(for='newPassword2') #{translate("confirm_new_password")}
|
label(for='newPassword2') #{translate("confirm_new_password")}
|
||||||
input.form-control(
|
input.form-control(
|
||||||
|
@ -140,11 +139,11 @@ block content
|
||||||
placeholder='*********',
|
placeholder='*********',
|
||||||
ng-model="newPassword2",
|
ng-model="newPassword2",
|
||||||
equals="passwordField"
|
equals="passwordField"
|
||||||
)
|
)
|
||||||
span.small.text-danger(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty" aria-live="polite")
|
span.small.text-danger(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty" aria-live="polite")
|
||||||
| #{translate("doesnt_match")}
|
| #{translate("doesnt_match")}
|
||||||
span.small.text-danger(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty" aria-live="polite")
|
span.small.text-danger(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty" aria-live="polite")
|
||||||
| #{translate("invalid_password")}
|
| #{translate("invalid_password")}
|
||||||
.form-group
|
.form-group
|
||||||
form-messages(aria-live="polite" for="changePasswordForm")
|
form-messages(aria-live="polite" for="changePasswordForm")
|
||||||
.actions
|
.actions
|
||||||
|
@ -158,16 +157,16 @@ block content
|
||||||
|
|
||||||
h3
|
h3
|
||||||
| #{translate("sharelatex_beta_program")}
|
| #{translate("sharelatex_beta_program")}
|
||||||
|
|
||||||
if (user.betaProgram)
|
if (user.betaProgram)
|
||||||
p.small
|
p.small
|
||||||
| #{translate("beta_program_already_participating")}
|
| #{translate("beta_program_already_participating")}
|
||||||
|
|
||||||
div
|
div
|
||||||
a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
|
a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
|
||||||
|
|
||||||
hr
|
hr
|
||||||
|
|
||||||
h3
|
h3
|
||||||
| #{translate("sessions")}
|
| #{translate("sessions")}
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ block content
|
||||||
if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
|
if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
|
||||||
|
|
||||||
p.small
|
p.small
|
||||||
| #{translate("newsletter_info_and_unsubscribe")}
|
| #{translate("newsletter_info_and_unsubscribe")}
|
||||||
a(
|
a(
|
||||||
href,
|
href,
|
||||||
ng-click="unsubscribe()",
|
ng-click="unsubscribe()",
|
||||||
|
@ -205,7 +204,7 @@ block content
|
||||||
| Please note: If you have linked your account with Overleaf
|
| Please note: If you have linked your account with Overleaf
|
||||||
| v2, then deleting your ShareLaTeX account will also delete
|
| v2, then deleting your ShareLaTeX account will also delete
|
||||||
| account and all of it's associated projects and data.
|
| account and all of it's associated projects and data.
|
||||||
p #{translate("need_to_leave")}
|
p #{translate("need_to_leave")}
|
||||||
a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
|
a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,21 @@ import 'libs/passfield'
|
||||||
App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
||||||
controller: [
|
controller: [
|
||||||
'$scope',
|
'$scope',
|
||||||
function($scope) {
|
'$location',
|
||||||
|
function($scope, $location) {
|
||||||
this.getEmail = () => $scope.email
|
this.getEmail = () => $scope.email
|
||||||
|
this.getEmailFromQuery = () =>
|
||||||
|
$location.search().email || $location.search().new_email
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
link(scope, element, attrs) {
|
link(scope, element, attrs, ctrl) {
|
||||||
let response
|
let response
|
||||||
const formName = attrs.asyncForm
|
const formName = attrs.asyncForm
|
||||||
|
|
||||||
scope[attrs.name].response = response = {}
|
scope[attrs.name].response = response = {}
|
||||||
scope[attrs.name].inflight = false
|
scope[attrs.name].inflight = false
|
||||||
|
scope.email = scope.email || ctrl.getEmailFromQuery() || attrs.newEmail
|
||||||
|
|
||||||
const validateCaptchaIfEnabled = function(callback) {
|
const validateCaptchaIfEnabled = function(callback) {
|
||||||
if (attrs.captchaActionName) {
|
if (attrs.captchaActionName) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ block content
|
||||||
)
|
)
|
||||||
.alert.alert-danger(ng-show="activationForm.response.error")
|
.alert.alert-danger(ng-show="activationForm.response.error")
|
||||||
| #{translate("activation_token_expired")}
|
| #{translate("activation_token_expired")}
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label(for='email') #{translate("email")}
|
label(for='email') #{translate("email")}
|
||||||
input.form-control(
|
input.form-control(
|
||||||
|
@ -35,7 +35,6 @@ block content
|
||||||
placeholder="email@example.com"
|
placeholder="email@example.com"
|
||||||
required,
|
required,
|
||||||
ng-model="email",
|
ng-model="email",
|
||||||
ng-init="email = "+JSON.stringify(email),
|
|
||||||
ng-model-options="{ updateOn: 'blur' }",
|
ng-model-options="{ updateOn: 'blur' }",
|
||||||
disabled
|
disabled
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue