Skip to content

Commit 8cef432

Browse files
authored
Merge branch 'develop' into mongodb-connection-update
2 parents 634b41f + 9e5d1e3 commit 8cef432

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

server/controllers/user.controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ export async function updateSettings(req, res) {
295295
}
296296
user.username = req.body.username;
297297

298+
if (req.body.newPassword) {
299+
if (user.password === undefined) {
300+
user.password = req.body.newPassword;
301+
saveUser(res, user);
302+
}
303+
if (!req.body.currentPassword) {
304+
res.status(401).json({ error: 'Current password is not provided.' });
305+
return;
306+
}
307+
}
298308
if (req.body.currentPassword) {
299309
const isMatch = await user.comparePassword(req.body.currentPassword);
300310
if (!isMatch) {

0 commit comments

Comments
 (0)