File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
backend/user-service/controller Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -4,20 +4,19 @@ import { formatUserResponse } from "./user-controller.js";
4
4
import { jwtConfig , REFRESH_TOKEN_COOKIE_KEY , refreshTokenCookieOptions } from "../config/authConfig.js" ;
5
5
import TokenService from "../services/tokenService.js" ;
6
6
import { BadRequestError , NotFoundError , UnauthorisedError } from "../utils/httpErrors.js" ;
7
- import { decode } from "jsonwebtoken" ;
8
7
9
8
export async function handleLogin ( req , res , next ) {
10
9
const { email, password } = req . body ;
11
10
if ( email && password ) {
12
11
try {
13
12
const user = await _findUserByEmail ( email ) ;
14
13
if ( ! user ) {
15
- throw new UnauthorisedError ( "Wrong email" ) ;
14
+ throw new UnauthorisedError ( "Wrong email/password " ) ;
16
15
}
17
16
18
17
const match = await bcrypt . compare ( password , user . password ) ;
19
18
if ( ! match ) {
20
- throw new UnauthorisedError ( "Wrong password" ) ;
19
+ throw new UnauthorisedError ( "Wrong email/ password" ) ;
21
20
}
22
21
23
22
// Generate access and refresh token
You can’t perform that action at this time.
0 commit comments