Factor out basic email check (#10244)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright 2016 OpenMarket Ltd
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -22,5 +23,8 @@ const EMAIL_ADDRESS_REGEX = new RegExp(
|
||||
);
|
||||
|
||||
export function looksValid(email: string): boolean {
|
||||
// short circuit regex with this basic check
|
||||
if (email.indexOf("@") < 1) return false;
|
||||
|
||||
return EMAIL_ADDRESS_REGEX.test(email);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user