Skip to content

Commit cc8f880

Browse files
Merge pull request #27 from brandonnorsworthy/more-features
More features
2 parents 985d220 + 03dd8c6 commit cc8f880

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

controllers/auth.controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ export default {
6363
const { username, password } = request.body;
6464

6565
const user = await userService.getUserByUsername(username);
66+
const errorMessage = 'Invalid username or password';
6667

6768
if (user === null) {
68-
return response.status(400).json({ error: 'User not found' });
69+
return response.status(400).json({ error: errorMessage });
6970
}
7071

7172
const token = await authService.createTokenSession(user, password);
7273
if (token === null) {
73-
return response.status(400).json({ error: 'Invalid password' });
74+
return response.status(400).json({ error: errorMessage });
7475
}
7576

7677
response.status(200).json({ token });

0 commit comments

Comments
 (0)