1
0
mirror of https://git.boykissers.com/pawkey/pawkey-sk.git synced 2025-12-20 04:04:16 +00:00

fix(backend): メールアドレスの形式が正しくなければ以降の処理を行わないように (#15320)

* Mod: バリデーションを追加

* 条件の修正

notつけわすれ

* Update CHANGELOG.md
This commit is contained in:
鴇峰 朔華
2025-02-16 18:41:33 +09:00
committed by GitHub
parent e2a55e2a31
commit f3a4434830
3 changed files with 16 additions and 1 deletions

View File

@@ -38,6 +38,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;