fix: improve login error messages for better clarity
This commit is contained in:
parent
eba4e31d38
commit
90e05c5989
1 changed files with 4 additions and 3 deletions
|
|
@ -109,7 +109,7 @@ export const logIn = async ({
|
||||||
if (!user) {
|
if (!user) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "NOT_FOUND",
|
code: "NOT_FOUND",
|
||||||
message: "Utente non trovato",
|
message: "Errore in Login: Utente non trovato",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//Check if user is blocked or unverified
|
//Check if user is blocked or unverified
|
||||||
|
|
@ -117,7 +117,7 @@ export const logIn = async ({
|
||||||
if (user.isBlocked) {
|
if (user.isBlocked) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "FORBIDDEN",
|
code: "FORBIDDEN",
|
||||||
message: "Utente bloccato",
|
message: "Errore in Login: Utente bloccato",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ export const logIn = async ({
|
||||||
if (!passworIsMatch) {
|
if (!passworIsMatch) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "Invalid email or password",
|
message: "Errore in Login: Invalid email or password",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -182,6 +182,7 @@ export const logIn = async ({
|
||||||
message: "Errore durante il login, refresh token non impostato",
|
message: "Errore durante il login, refresh token non impostato",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return { status: "success" as const };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "INTERNAL_SERVER_ERROR",
|
code: "INTERNAL_SERVER_ERROR",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue