diff --git a/src/controllers/AuthController.ts b/src/controllers/AuthController.ts index c6b7049..c8c6954 100644 --- a/src/controllers/AuthController.ts +++ b/src/controllers/AuthController.ts @@ -14,7 +14,7 @@ export class AuthController { async login(loginRequest : LoginRequestDto): Promise { const userName :string|undefined = loginRequest.userName; const password :string|undefined = loginRequest.password; - console.log("user", userName, " is trying to log in with password", password) + console.log("user", userName, " is trying to log in") if (!userName || !password) { throw new ValidationError("Username and password are required"); } diff --git a/src/migrations/1758477574859-CreateUserTable.ts b/src/migrations/1758477574859-CreateUserTable.ts index b6151ea..340d313 100644 --- a/src/migrations/1758477574859-CreateUserTable.ts +++ b/src/migrations/1758477574859-CreateUserTable.ts @@ -66,6 +66,13 @@ export class CreateUserTable1661234567890 implements MigrationInterface { name: "UQ_user_userName", }) ); + + // Insert a default admin user - password is stored in shared/recipe-backend + await queryRunner.query( + `INSERT INTO "user" ("id", "userName", "email", "password", "role") + VALUES (uuid_generate_v4(), $1, $2, $3, $4)`, + ["admin", "anika@raemer.net", "$2b$12$zySMBXDcPF4VWpyvXluYwOS4pWJlED.peAvK9NEMewht6UQGw/8WK", "admin"] + ); } public async down(queryRunner: QueryRunner): Promise {