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")
|
||||||
|
|
|
@ -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")
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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