({
username,
password,
}: {
username: User['username']
password: string
})
| 71 | } |
| 72 | |
| 73 | export async function login({ |
| 74 | username, |
| 75 | password, |
| 76 | }: { |
| 77 | username: User['username'] |
| 78 | password: string |
| 79 | }) { |
| 80 | const user = await verifyUserPassword({ username }, password) |
| 81 | if (!user) return null |
| 82 | const session = await prisma.session.create({ |
| 83 | select: { id: true, expirationDate: true, userId: true }, |
| 84 | data: { |
| 85 | expirationDate: getSessionExpirationDate(), |
| 86 | userId: user.id, |
| 87 | }, |
| 88 | }) |
| 89 | return session |
| 90 | } |
| 91 | |
| 92 | export async function resetUserPassword({ |
| 93 | username, |
no test coverage detected