diff --git a/data_migration_tools/server/src/common/password/password.ts b/data_migration_tools/server/src/common/password/password.ts index 6fbe071..15d52ce 100644 --- a/data_migration_tools/server/src/common/password/password.ts +++ b/data_migration_tools/server/src/common/password/password.ts @@ -18,7 +18,8 @@ export const makePassword = (): string => { let autoGeneratedPassword: string = ""; while (!valid) { - // パスワードをランダムに決定 + autoGeneratedPassword = ""; + // パスワードをランダムに決定+ while (autoGeneratedPassword.length < passLength) { // 上で決定したcharsの中からランダムに1文字ずつ追加 const index = Math.floor(Math.random() * chars.length); @@ -30,6 +31,11 @@ export const makePassword = (): string => { valid = autoGeneratedPassword.length == passLength && charaTypePattern.test(autoGeneratedPassword); + if (!valid) { + // autoGeneratedPasswordをログに出す + console.log("Password is not valid"); + console.log(autoGeneratedPassword); + } } return autoGeneratedPassword; }; diff --git a/data_migration_tools/server/src/features/accounts/accounts.service.ts b/data_migration_tools/server/src/features/accounts/accounts.service.ts index 2954cbd..fdfb458 100644 --- a/data_migration_tools/server/src/features/accounts/accounts.service.ts +++ b/data_migration_tools/server/src/features/accounts/accounts.service.ts @@ -79,6 +79,7 @@ export class AccountsService { HttpStatus.INTERNAL_SERVER_ERROR ); } + this.logger.log("idpにユーザーを作成成功"); // メールアドレス重複エラー if (isConflictError(externalUser)) { @@ -90,6 +91,7 @@ export class AccountsService { HttpStatus.BAD_REQUEST ); } + this.logger.log("メールアドレスは重複していません"); let account: Account; let user: User; @@ -138,6 +140,7 @@ export class AccountsService { account.id, country ); + this.logger.log("コンテナー作成成功"); } catch (e) { this.logger.error(`[${context.getTrackingId()}] error=${e}`); this.logger.error( diff --git a/data_migration_tools/server/src/features/register/register.controller.ts b/data_migration_tools/server/src/features/register/register.controller.ts index cb36d2a..d9b968f 100644 --- a/data_migration_tools/server/src/features/register/register.controller.ts +++ b/data_migration_tools/server/src/features/register/register.controller.ts @@ -106,8 +106,10 @@ export class RegisterController { } for (const AccountsFile of accountsObject) { + this.logger.log("ランダムパスワード生成開始"); // ランダムなパスワードを生成する const ramdomPassword = makePassword(); + this.logger.log("ランダムパスワード生成完了"); // roleの設定 // roleの値がnullなら"none"、null以外ならroleの値、 // また、roleの値が"author"なら"author"を設定 @@ -123,6 +125,7 @@ export class RegisterController { // ありえないが、roleの値が"none"または"author"の文字列以外の場合はエラーを返す throw new Error("Invalid role value"); } + this.logger.log("account生成開始"); await this.accountsService.createAccount( context, AccountsFile.companyName, diff --git a/data_migration_tools/server/src/features/users/users.service.ts b/data_migration_tools/server/src/features/users/users.service.ts index cb639cd..8134462 100644 --- a/data_migration_tools/server/src/features/users/users.service.ts +++ b/data_migration_tools/server/src/features/users/users.service.ts @@ -74,6 +74,9 @@ export class UsersService { accountId, authorId ); + this.logger.log( + `[${context.getTrackingId()}] isAuthorIdDuplicated=${isAuthorIdDuplicated}` + ); } catch (e) { this.logger.error(`[${context.getTrackingId()}] error=${e}`); throw new HttpException( @@ -88,9 +91,10 @@ export class UsersService { ); } } - + this.logger.log("ランダムパスワード生成開始"); // ランダムなパスワードを生成する const ramdomPassword = makePassword(); + this.logger.log("ランダムパスワード生成完了"); //Azure AD B2Cにユーザーを新規登録する let externalUser: { sub: string } | ConflictError; diff --git a/data_migration_tools/server/src/gateways/adb2c/adb2c.service.ts b/data_migration_tools/server/src/gateways/adb2c/adb2c.service.ts index 5ba0f0e..5dbe646 100644 --- a/data_migration_tools/server/src/gateways/adb2c/adb2c.service.ts +++ b/data_migration_tools/server/src/gateways/adb2c/adb2c.service.ts @@ -82,6 +82,9 @@ export class AdB2cService { }, ], }); + this.logger.log( + `[${context.getTrackingId()}] [ADB2C CREATE] newUser: ${newUser}` + ); return { sub: newUser.id }; } catch (e) { this.logger.error(`[${context.getTrackingId()}] error=${e}`);