Skip to content

Commit 11b6f1d

Browse files
committed
♻️ Fix hard-coded seed password (#1124)
1 parent 69c24d0 commit 11b6f1d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

prisma/seed.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { generateLuciaPasswordHash } from 'lucia/utils';
2222

2323
import { classifyContest } from '../src/lib/utils/contest';
2424

25-
import { users } from './users';
25+
import { users, USER_PASSWORD_FOR_SEED } from './users';
2626
import { tasks } from './tasks';
2727
import { workbooks } from './workbooks';
2828
import { tags } from './tags';
@@ -70,15 +70,14 @@ async function addUsers() {
7070
for (const user of users) {
7171
userQueue.add(async () => {
7272
try {
73-
const password = 'Ch0kuda1';
7473
const registeredUser = await prisma.user.findUnique({
7574
where: {
7675
username: user.name,
7776
},
7877
});
7978

8079
if (!registeredUser) {
81-
await addUser(user, password, userFactory, keyFactory);
80+
await addUser(user, USER_PASSWORD_FOR_SEED, userFactory, keyFactory);
8281
console.log('username:', user.name, 'was registered.');
8382
}
8483
} catch (e) {

prisma/users.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ export const users = [
1111
{ id: '8', name: 'Frank', role: Roles.USER },
1212
{ id: '9', name: 'hogehoge', role: Roles.USER },
1313
];
14+
15+
export const USER_PASSWORD_FOR_SEED = 'Ch0kuda1';

0 commit comments

Comments
 (0)