notherbase-fs 4.1.1 → 4.1.3
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 -6
- package/package.json +1 -1
package/controllers/user.js
CHANGED
|
@@ -190,7 +190,6 @@ export default class User {
|
|
|
190
190
|
if (check(res, user, "Account not found!")) {
|
|
191
191
|
let data = await req.db.Spirit.recallAll(null, user.memory._id);
|
|
192
192
|
let dataToDownload = data.map(d => d.memory);
|
|
193
|
-
dataToDownload.unshift(user.memory.data);
|
|
194
193
|
|
|
195
194
|
successJSON(res, "Data Downloaded", dataToDownload);
|
|
196
195
|
}
|
|
@@ -203,12 +202,14 @@ export default class User {
|
|
|
203
202
|
let user = await req.db.Spirit.recallOne("user", null, { username: req.session.currentUser });
|
|
204
203
|
|
|
205
204
|
if (check(res, user, "Account not found!")) {
|
|
206
|
-
|
|
205
|
+
if (check(res, req.body.password, "Password error.")) {
|
|
206
|
+
let passResult = await bcrypt.compare(req.body.password, user.memory.data.password);
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
if (check(res, passResult, "Password doesn't match the username.")) {
|
|
209
|
+
let deleted = await req.db.Spirit.delete(null, user.memory._id);
|
|
210
|
+
if (check(res, deleted > 0, "No data deleted")) {
|
|
211
|
+
success(res, "Data Deleted", deleted);
|
|
212
|
+
}
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
215
|
}
|