mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-10 17:00:11 +01:00
patch: bug when disabling password protection being invalid even though it should be disabled
This commit is contained in:
parent
961630f7d5
commit
bfc9a96e87
@ -436,14 +436,21 @@ function systemEndpoints(app) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let error = null;
|
||||||
const { usePassword, newPassword } = reqBody(request);
|
const { usePassword, newPassword } = reqBody(request);
|
||||||
const { error } = await updateENV(
|
if (!usePassword) { // Password is being disabled so directly unset everything to bypass validation.
|
||||||
{
|
process.env.AUTH_TOKEN = "";
|
||||||
AuthToken: usePassword ? newPassword : "",
|
process.env.JWT_SECRET = "";
|
||||||
JWTSecret: usePassword ? v4() : "",
|
} else {
|
||||||
},
|
error = await updateENV(
|
||||||
true
|
{
|
||||||
);
|
AuthToken: newPassword,
|
||||||
|
JWTSecret: v4(),
|
||||||
|
},
|
||||||
|
true
|
||||||
|
)?.error;
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") await dumpENV();
|
if (process.env.NODE_ENV === "production") await dumpENV();
|
||||||
response.status(200).json({ success: !error, error });
|
response.status(200).json({ success: !error, error });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user