Skip to content

Commit e36a3f3

Browse files
committed
added setting/resetting password after socail login
1 parent d5eee45 commit e36a3f3

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
@@ -344,6 +344,16 @@ export function updateSettings(req, res) {
344344

345345
user.username = req.body.username;
346346

347+
if (req.body.newPassword) {
348+
if (user.password === undefined) {
349+
user.password = req.body.newPassword;
350+
saveUser(res, user);
351+
}
352+
if (!req.body.currentPassword) {
353+
res.status(401).json({ error: 'Current password is not provided.' });
354+
return;
355+
}
356+
}
347357
if (req.body.currentPassword) {
348358
user.comparePassword(req.body.currentPassword, (passwordErr, isMatch) => {
349359
if (passwordErr) throw passwordErr;

0 commit comments

Comments
 (0)