mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #7142 from overleaf/ii-6756-gmail-flags-emails-as-dangerous
Change security email title GitOrigin-RevId: d33c9d7998ada059dac61ba0d13eefedd66237fc
This commit is contained in:
parent
7f4934d619
commit
0703c6d21d
3 changed files with 15 additions and 6 deletions
|
@ -1,16 +1,25 @@
|
|||
function _getIndefiniteArticle(providerName) {
|
||||
const vowels = ['a', 'e', 'i', 'o', 'u']
|
||||
if (vowels.includes(providerName.charAt(0).toLowerCase())) return 'an'
|
||||
return 'a'
|
||||
|
||||
return vowels.includes(providerName.charAt(0).toLowerCase()) ? 'an' : 'a'
|
||||
}
|
||||
|
||||
function _actionBuilder(providerName, action, accountLinked) {
|
||||
if (providerName.toLowerCase() !== 'google') {
|
||||
return `${providerName} account ${action}`
|
||||
}
|
||||
|
||||
return accountLinked ? `New account ${action}` : `Account ${action}`
|
||||
}
|
||||
|
||||
function linkOrUnlink(accountLinked, providerName, email) {
|
||||
const action = accountLinked ? 'linked' : 'no longer linked'
|
||||
const actionDescribed = accountLinked ? 'was linked to' : 'was unlinked from'
|
||||
const indefiniteArticle = _getIndefiniteArticle(providerName)
|
||||
|
||||
return {
|
||||
to: email,
|
||||
action: `${providerName} account ${action}`,
|
||||
action: _actionBuilder(providerName, action, accountLinked),
|
||||
actionDescribed: `${indefiniteArticle} ${providerName} account ${actionDescribed} your account ${email}`,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ function _sendSecurityAlert(accountLinked, providerId, user, userId) {
|
|||
if (error) {
|
||||
logger.error(
|
||||
{ err: error, userId },
|
||||
`could not send security alert email when ${emailOptions.action}`
|
||||
`could not send security alert email when ${emailOptions.action.toLowerCase()}`
|
||||
)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -155,7 +155,7 @@ describe('ThirdPartyIdentityManager', function () {
|
|||
err: anError,
|
||||
userId: this.userId,
|
||||
},
|
||||
'could not send security alert email when Google account linked'
|
||||
'could not send security alert email when new account linked'
|
||||
)
|
||||
done()
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ describe('ThirdPartyIdentityManager', function () {
|
|||
err: anError,
|
||||
userId: this.userId,
|
||||
},
|
||||
'could not send security alert email when Google account no longer linked'
|
||||
'could not send security alert email when account no longer linked'
|
||||
)
|
||||
done()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue