We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 828d967 commit 1d4daccCopy full SHA for 1d4dacc
pages/api/changepassword.js
@@ -3,13 +3,20 @@ import bcrypt from "bcrypt";
3
import { jwtAuth, use } from "../../middleware/middleware";
4
import { changePassword, getUser } from "../../lib/dbfunc";
5
6
+const changePasswordEnabled = process.env.changePasswordEnabled || true;
7
const saltRounds = 10;
8
9
async function handler(req, res) {
10
if (req.method !== "POST") {
11
res.status(400).send("method not allowed");
12
return;
13
}
14
+
15
+ if (!changePasswordEnabled) {
16
+ res.status(401).send("Change Password not allowed");
17
+ return;
18
+ }
19
20
try {
21
// Run the middleware
22
await use(req, res, jwtAuth);
0 commit comments