fix: next auth host not trusted (#144)
This commit is contained in:
@@ -40,7 +40,7 @@ export const LoginForm = () => {
|
|||||||
callbackUrl: "/",
|
callbackUrl: "/",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (!response?.ok) {
|
if (!response?.ok || response.error) {
|
||||||
throw response?.error;
|
throw response?.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ const adapter = DrizzleAdapter(db);
|
|||||||
|
|
||||||
export const createConfiguration = (isCredentialsRequest: boolean) =>
|
export const createConfiguration = (isCredentialsRequest: boolean) =>
|
||||||
NextAuth({
|
NextAuth({
|
||||||
|
logger: {
|
||||||
|
error: (code, ...message) => {
|
||||||
|
// Remove the big error message for failed login attempts
|
||||||
|
// as it is not useful for the user.
|
||||||
|
if (code.name === "CredentialsSignin") {
|
||||||
|
console.warn("The login attempt of a user was not successful.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(code, ...message);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
trustHost: true,
|
||||||
adapter,
|
adapter,
|
||||||
providers: [
|
providers: [
|
||||||
Credentials(createCredentialsConfiguration(db)),
|
Credentials(createCredentialsConfiguration(db)),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export const createCredentialsConfiguration = (db: Database) =>
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!user?.password) {
|
if (!user?.password) {
|
||||||
|
console.log(`user ${data.name} was not found`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user