Merged PR 607: メールアドレス入力チェックの修正

## 概要
[Task3232: メールアドレス入力チェックの修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3232)

- メールアドレス入力に対して規約に則ったチェックを実施するように修正しました。
  - 画面での入力チェックとAPIのバリデーションを修正しています。

## レビューポイント
- クライアントのチェック内容は規約に則った内容になっているでしょうか?
  - 正規表現の構文として不自然な点はないでしょうか?
- サーバー側のチェックをIsEmail+禁止文字の追加という形で対応していますが適切でしょうか?

## UIの変更
- なし

## 動作確認状況
- ローカルで確認
This commit is contained in:
makabe.t 2023-12-08 02:14:25 +00:00
parent 342baa9826
commit a0da277c05
5 changed files with 15 additions and 6 deletions

View File

@ -8,8 +8,11 @@ export const selectInputValidationErrors = (state: RootState) => {
const hasErrorEmptyAdminName = state.partner.apps.addPartner.adminName === "";
const hasErrorEmptyEmail = state.partner.apps.addPartner.email === "";
const emailPattern =
/^[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]+@[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*\.[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*[a-zA-Z]$/;
const hasErrorIncorrectEmail =
(state.partner.apps.addPartner.email as string).match(/^[^@]+@[^@]+$/)
(state.partner.apps.addPartner.email as string).match(emailPattern)
?.length !== 1;
return {

View File

@ -16,8 +16,10 @@ export const selectInputValidationErrors = (state: RootState) => {
state.signup.apps.password
);
const emailPattern =
/^[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]+@[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*\.[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*[a-zA-Z]$/;
const hasErrorIncorrectEmail =
(state.signup.apps.email as string).match(/^[^@]+@[^@]+$/)?.length !== 1;
(state.signup.apps.email as string).match(emailPattern)?.length !== 1;
return {
hasErrorEmptyEmail,

View File

@ -26,7 +26,10 @@ export const selectInputValidationErrors = (state: RootState) => {
role
);
const hasErrorIncorrectEmail = email.match(/^[^@]+@[^@]+$/)?.length !== 1;
const emailPattern =
/^[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]+@[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*\.[a-zA-Z0-9!#$%&'_`/=~+\-?^{|}.]*[a-zA-Z]$/;
const hasErrorIncorrectEmail = email.match(emailPattern)?.length !== 1;
const hasErrorIncorrectEncryptionPassword =
checkErrorIncorrectEncryptionPassword(encryptionPassword, role, encryption);

View File

@ -38,7 +38,7 @@ export class CreateAccountRequest {
@ApiProperty()
adminName: string;
@ApiProperty()
@IsEmail()
@IsEmail({ blacklisted_chars: '*' })
adminMail: string;
@ApiProperty()
@IsAdminPasswordvalid()
@ -244,7 +244,7 @@ export class CreatePartnerAccountRequest {
@ApiProperty()
adminName: string;
@ApiProperty()
@IsEmail()
@IsEmail({ blacklisted_chars: '*' })
email: string;
}

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsIn } from 'class-validator';
import { IsEmail, IsIn } from 'class-validator';
import {
TASK_LIST_SORTABLE_ATTRIBUTES,
USER_LICENSE_STATUS,
@ -88,6 +88,7 @@ export class SignupRequest {
authorId?: string;
@ApiProperty()
@IsEmail({ blacklisted_chars: '*' })
email: string;
@ApiProperty()