mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
[web] add support for regex based allow-list for skipping captcha (#24266)
* [web] double down on validating email addresses * [web] normalize emails in captcha middleware * [web] add support for regex based allow-list for skipping captcha * [web] skip captcha for trusted users on all actions GitOrigin-RevId: a994ebf6b74e80f462d2dab1fe5113bbffa676a9
This commit is contained in:
@@ -18,6 +18,24 @@ describe('EmailHelper', function () {
|
||||
expect(parseEmail(address, true)).to.equal(expected)
|
||||
})
|
||||
|
||||
it('should return null for garbage input', function () {
|
||||
const cases = [
|
||||
undefined,
|
||||
null,
|
||||
'',
|
||||
42,
|
||||
['test@example.com'],
|
||||
{},
|
||||
{ length: 42 },
|
||||
{ trim: true, match: true },
|
||||
{ toString: true },
|
||||
]
|
||||
for (const input of cases) {
|
||||
expect(parseEmail(input)).to.equal(null, input)
|
||||
expect(parseEmail(input, true)).to.equal(null, input)
|
||||
}
|
||||
})
|
||||
|
||||
it('should return null for an invalid single email', function () {
|
||||
const address = 'testexample.com'
|
||||
expect(parseEmail(address)).to.equal(null)
|
||||
|
||||
Reference in New Issue
Block a user