summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/UtilityService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/UtilityService.ts')
-rw-r--r--packages/backend/src/core/UtilityService.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts
index 81eaa5f95d..cb534a229c 100644
--- a/packages/backend/src/core/UtilityService.ts
+++ b/packages/backend/src/core/UtilityService.ts
@@ -39,6 +39,14 @@ export class UtilityService {
return this.punyHost(uri) === this.toPuny(this.config.host);
}
+ // メールアドレスのバリデーションを行う
+ // https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
+ @bindThis
+ public validateEmailFormat(email: string): boolean {
+ const regexp = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
+ return regexp.test(email);
+ }
+
@bindThis
public isBlockedHost(blockedHosts: string[], host: string | null): boolean {
if (host == null) return false;