Merged PR 794: 登録ツールにログを仕込む
## 概要 [Task3839: 登録ツールにログを仕込む](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3839) 登録ツールが途中で動かなくなってしまう原因調査のために各関数にログを仕込みました。 ## レビューポイント - 特になし ## 動作確認状況 - ローカルで確認 ## 補足 - 相談、参考資料などがあれば
This commit is contained in:
parent
0ebd2ab17e
commit
cad3a99f70
@ -18,7 +18,8 @@ export const makePassword = (): string => {
|
|||||||
let autoGeneratedPassword: string = "";
|
let autoGeneratedPassword: string = "";
|
||||||
|
|
||||||
while (!valid) {
|
while (!valid) {
|
||||||
// パスワードをランダムに決定
|
autoGeneratedPassword = "";
|
||||||
|
// パスワードをランダムに決定+
|
||||||
while (autoGeneratedPassword.length < passLength) {
|
while (autoGeneratedPassword.length < passLength) {
|
||||||
// 上で決定したcharsの中からランダムに1文字ずつ追加
|
// 上で決定したcharsの中からランダムに1文字ずつ追加
|
||||||
const index = Math.floor(Math.random() * chars.length);
|
const index = Math.floor(Math.random() * chars.length);
|
||||||
@ -30,6 +31,11 @@ export const makePassword = (): string => {
|
|||||||
valid =
|
valid =
|
||||||
autoGeneratedPassword.length == passLength &&
|
autoGeneratedPassword.length == passLength &&
|
||||||
charaTypePattern.test(autoGeneratedPassword);
|
charaTypePattern.test(autoGeneratedPassword);
|
||||||
|
if (!valid) {
|
||||||
|
// autoGeneratedPasswordをログに出す
|
||||||
|
console.log("Password is not valid");
|
||||||
|
console.log(autoGeneratedPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return autoGeneratedPassword;
|
return autoGeneratedPassword;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -79,6 +79,7 @@ export class AccountsService {
|
|||||||
HttpStatus.INTERNAL_SERVER_ERROR
|
HttpStatus.INTERNAL_SERVER_ERROR
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
this.logger.log("idpにユーザーを作成成功");
|
||||||
|
|
||||||
// メールアドレス重複エラー
|
// メールアドレス重複エラー
|
||||||
if (isConflictError(externalUser)) {
|
if (isConflictError(externalUser)) {
|
||||||
@ -90,6 +91,7 @@ export class AccountsService {
|
|||||||
HttpStatus.BAD_REQUEST
|
HttpStatus.BAD_REQUEST
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
this.logger.log("メールアドレスは重複していません");
|
||||||
|
|
||||||
let account: Account;
|
let account: Account;
|
||||||
let user: User;
|
let user: User;
|
||||||
@ -138,6 +140,7 @@ export class AccountsService {
|
|||||||
account.id,
|
account.id,
|
||||||
country
|
country
|
||||||
);
|
);
|
||||||
|
this.logger.log("コンテナー作成成功");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
|
|||||||
@ -106,8 +106,10 @@ export class RegisterController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const AccountsFile of accountsObject) {
|
for (const AccountsFile of accountsObject) {
|
||||||
|
this.logger.log("ランダムパスワード生成開始");
|
||||||
// ランダムなパスワードを生成する
|
// ランダムなパスワードを生成する
|
||||||
const ramdomPassword = makePassword();
|
const ramdomPassword = makePassword();
|
||||||
|
this.logger.log("ランダムパスワード生成完了");
|
||||||
// roleの設定
|
// roleの設定
|
||||||
// roleの値がnullなら"none"、null以外ならroleの値、
|
// roleの値がnullなら"none"、null以外ならroleの値、
|
||||||
// また、roleの値が"author"なら"author"を設定
|
// また、roleの値が"author"なら"author"を設定
|
||||||
@ -123,6 +125,7 @@ export class RegisterController {
|
|||||||
// ありえないが、roleの値が"none"または"author"の文字列以外の場合はエラーを返す
|
// ありえないが、roleの値が"none"または"author"の文字列以外の場合はエラーを返す
|
||||||
throw new Error("Invalid role value");
|
throw new Error("Invalid role value");
|
||||||
}
|
}
|
||||||
|
this.logger.log("account生成開始");
|
||||||
await this.accountsService.createAccount(
|
await this.accountsService.createAccount(
|
||||||
context,
|
context,
|
||||||
AccountsFile.companyName,
|
AccountsFile.companyName,
|
||||||
|
|||||||
@ -74,6 +74,9 @@ export class UsersService {
|
|||||||
accountId,
|
accountId,
|
||||||
authorId
|
authorId
|
||||||
);
|
);
|
||||||
|
this.logger.log(
|
||||||
|
`[${context.getTrackingId()}] isAuthorIdDuplicated=${isAuthorIdDuplicated}`
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
@ -88,9 +91,10 @@ export class UsersService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.logger.log("ランダムパスワード生成開始");
|
||||||
// ランダムなパスワードを生成する
|
// ランダムなパスワードを生成する
|
||||||
const ramdomPassword = makePassword();
|
const ramdomPassword = makePassword();
|
||||||
|
this.logger.log("ランダムパスワード生成完了");
|
||||||
|
|
||||||
//Azure AD B2Cにユーザーを新規登録する
|
//Azure AD B2Cにユーザーを新規登録する
|
||||||
let externalUser: { sub: string } | ConflictError;
|
let externalUser: { sub: string } | ConflictError;
|
||||||
|
|||||||
@ -82,6 +82,9 @@ export class AdB2cService {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
this.logger.log(
|
||||||
|
`[${context.getTrackingId()}] [ADB2C CREATE] newUser: ${newUser}`
|
||||||
|
);
|
||||||
return { sub: newUser.id };
|
return { sub: newUser.id };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
this.logger.error(`[${context.getTrackingId()}] error=${e}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user