notherbase-fs 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/user.js +7 -5
- package/package.json +1 -1
package/controllers/user.js
CHANGED
|
@@ -203,12 +203,14 @@ export default class User {
|
|
|
203
203
|
let user = await req.db.Spirit.recallOne("user", null, { username: req.session.currentUser });
|
|
204
204
|
|
|
205
205
|
if (check(res, user, "Account not found!")) {
|
|
206
|
-
|
|
206
|
+
if (check(res, req.body.password, "Password error.")) {
|
|
207
|
+
let passResult = await bcrypt.compare(req.body.password, user.memory.data.password);
|
|
207
208
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
if (check(res, passResult, "Password doesn't match the username.")) {
|
|
210
|
+
let deleted = await req.db.Spirit.delete(null, user.memory._id);
|
|
211
|
+
if (check(res, deleted > 0, "No data deleted")) {
|
|
212
|
+
success(res, "Data Deleted", deleted);
|
|
213
|
+
}
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
}
|