notherbase-fs 1.2.2 → 1.2.5
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/explorer.js +3 -2
- package/controllers/user.js +2 -3
- package/package.json +1 -1
- package/views/account.ejs +1 -29
package/controllers/explorer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { inventory, game, item } = require("../models");
|
|
1
|
+
const { inventory, game, item, user } = require("../models");
|
|
2
2
|
|
|
3
3
|
let router = require("express").Router();;
|
|
4
4
|
let dir = "";
|
|
@@ -63,6 +63,7 @@ let complete = function complete(explorerBuild) {
|
|
|
63
63
|
|
|
64
64
|
router.get(currentRoute, async function(req, res) {
|
|
65
65
|
try {
|
|
66
|
+
const foundUser = await user.findById(req.session.currentUser);
|
|
66
67
|
const foundInventory = await inventory.findOne({ user: req.session.currentUser }).populate("items.item");
|
|
67
68
|
|
|
68
69
|
let serverScriptReturns = [];
|
|
@@ -84,7 +85,7 @@ let complete = function complete(explorerBuild) {
|
|
|
84
85
|
|
|
85
86
|
let context = {
|
|
86
87
|
siteTitle: "NotherBase",
|
|
87
|
-
user:
|
|
88
|
+
user: foundUser,
|
|
88
89
|
styles: detail.options.styles,
|
|
89
90
|
externalStyles: detail.options.externalStyles,
|
|
90
91
|
main: detail.options.main,
|
package/controllers/user.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const express = require("express");
|
|
2
2
|
const router = express.Router();
|
|
3
3
|
const bcrypt = require("bcrypt");
|
|
4
|
-
const nodemailer = require("nodemailer");
|
|
5
4
|
|
|
6
5
|
// Import my Data
|
|
7
6
|
const { user, inventory, sendMail } = require("../models");
|
|
@@ -96,9 +95,9 @@ router.get("/password-reset", async function(req, res) {
|
|
|
96
95
|
}
|
|
97
96
|
});
|
|
98
97
|
|
|
99
|
-
router.post("/password-reset
|
|
98
|
+
router.post("/password-reset", async function(req, res) {
|
|
100
99
|
try {
|
|
101
|
-
const foundUser = await user.findOne({ "reset.token": req.
|
|
100
|
+
const foundUser = await user.findOne({ "reset.token": req.body.token });
|
|
102
101
|
|
|
103
102
|
if (foundUser) {
|
|
104
103
|
if (foundUser.reset.exp > Date.now()) {
|
package/package.json
CHANGED
package/views/account.ejs
CHANGED
|
@@ -31,12 +31,7 @@
|
|
|
31
31
|
<h3>Password:</h3>
|
|
32
32
|
<div class="setting" id="password">
|
|
33
33
|
<p>*********</p>
|
|
34
|
-
<
|
|
35
|
-
</div>
|
|
36
|
-
<div class="edit invisible" id="password">
|
|
37
|
-
<input type="password" name="password">
|
|
38
|
-
<button onclick="accountServices.updatePassword()">Update</button>
|
|
39
|
-
<button onclick="accountServices.cancelPassword()">Cancel</button>
|
|
34
|
+
<p>Visit the Keeper to Change Your Password</p>
|
|
40
35
|
</div>
|
|
41
36
|
|
|
42
37
|
<p id="info"></p>
|
|
@@ -132,29 +127,6 @@
|
|
|
132
127
|
else this.$info.text("Server Error");
|
|
133
128
|
}
|
|
134
129
|
}
|
|
135
|
-
|
|
136
|
-
editPassword() {
|
|
137
|
-
this.$passwordSetting.addClass("invisible");
|
|
138
|
-
this.$passwordEdit.removeClass("invisible");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
cancelPassword() {
|
|
142
|
-
this.$passwordSetting.removeClass("invisible");
|
|
143
|
-
this.$passwordEdit.addClass("invisible");
|
|
144
|
-
this.$passwordInput.val("");
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async updatePassword() {
|
|
148
|
-
try {
|
|
149
|
-
await $.post("/user/password", { password: this.$passwordInput.val() }, (data) => {
|
|
150
|
-
this.cancelPassword();
|
|
151
|
-
this.$info.text("Password Updated!");
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
catch(err) {
|
|
155
|
-
this.$info.text(err);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
130
|
}
|
|
159
131
|
|
|
160
132
|
let accountServices = new AccountServices();
|