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',
|
||||
sharedProjectData,
|
||||
newTemplateData,
|
||||
new_email: req.query.new_email || '',
|
||||
samlBeta: req.session.samlBeta
|
||||
})
|
||||
},
|
||||
|
@ -37,8 +36,7 @@ const UserPagesController = {
|
|||
AuthenticationController.setRedirectInSession(req, req.query.redir)
|
||||
}
|
||||
res.render('user/login', {
|
||||
title: 'login',
|
||||
email: req.query.email
|
||||
title: 'login'
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ block content
|
|||
placeholder='email@example.com',
|
||||
ng-model="email",
|
||||
ng-model-options="{ updateOn: 'blur' }",
|
||||
ng-init="email = "+JSON.stringify(email),
|
||||
focus="true"
|
||||
)
|
||||
span.small.text-primary(ng-show="loginForm.email.$invalid && loginForm.email.$dirty")
|
||||
|
|
|
@ -32,7 +32,6 @@ block content
|
|||
placeholder="email@example.com"
|
||||
required,
|
||||
ng-model="email",
|
||||
ng-init="email = "+JSON.stringify(user.email),
|
||||
ng-model-options="{ updateOn: 'blur' }"
|
||||
)
|
||||
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) => ({
|
||||
controller: [
|
||||
'$scope',
|
||||
function($scope) {
|
||||
'$location',
|
||||
function($scope, $location) {
|
||||
this.getEmail = () => $scope.email
|
||||
this.getEmailFromQuery = () =>
|
||||
$location.search().email || $location.search().new_email
|
||||
return this
|
||||
}
|
||||
],
|
||||
link(scope, element, attrs) {
|
||||
link(scope, element, attrs, ctrl) {
|
||||
let response
|
||||
const formName = attrs.asyncForm
|
||||
|
||||
scope[attrs.name].response = response = {}
|
||||
scope[attrs.name].inflight = false
|
||||
scope.email = scope.email || ctrl.getEmailFromQuery() || attrs.newEmail
|
||||
|
||||
const validateCaptchaIfEnabled = function(callback) {
|
||||
if (attrs.captchaActionName) {
|
||||
|
|
|
@ -35,7 +35,6 @@ block content
|
|||
placeholder="email@example.com"
|
||||
required,
|
||||
ng-model="email",
|
||||
ng-init="email = "+JSON.stringify(email),
|
||||
ng-model-options="{ updateOn: 'blur' }",
|
||||
disabled
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue