notherbase-fs 2.0.3 → 3.0.1
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/creation.js +57 -59
- package/controllers/spirit-world.js +55 -74
- package/controllers/spirits/contact.js +17 -10
- package/controllers/spirits/user.js +144 -112
- package/controllers/spirits/util.js +23 -31
- package/models/index.js +54 -117
- package/models/item.js +80 -0
- package/models/send-mail.js +2 -0
- package/models/spirit.js +77 -115
- package/models/user.js +189 -0
- package/notherbase-fs.js +1 -0
- package/package.json +1 -1
- package/public/styles/main.css +12 -3
- package/test/{explorer/coast/tall-beach/nono-cove/styles → coast/tall-beach/nono-cove}/index.css +0 -0
- package/test/coast/tall-beach/nono-cove/index.ejs +29 -0
- package/test/{explorer/coast/tall-beach/nono-cove/views/nono-og.ejs → coast/tall-beach/nono-cove/nono-og/index.ejs} +2 -2
- package/test/{explorer/coast/tall-beach/nono-cove/styles → coast/tall-beach/nono-cove/nono-og}/nono.css +0 -0
- package/test/{explorer/coast/tall-beach/nono-cove/local-scripts → coast/tall-beach/nono-cove/nono-og}/nono.js +1 -1
- package/test/{explorer/coast/tall-beach/nono-cove/server-scripts → test-page}/emailTime.js +0 -0
- package/test/{pages/test.ejs → test-page/index.ejs} +0 -0
- package/test/the-front/add-gold.js +35 -0
- package/test/the-front/check/add-more-gold.js +3 -0
- package/test/the-front/check/emailTime.js +11 -0
- package/test/the-front/check/index.ejs +13 -0
- package/test/the-front/check/subtract-gold.js +3 -0
- package/test/the-front/checks.js +11 -0
- package/test/the-front/incTranslation.js +9 -0
- package/test/the-front/index.ejs +107 -0
- package/test/void/index.ejs +4 -0
- package/test/void/void.css +3 -0
- package/views/explorer.ejs +32 -41
- package/views/menu/account.ejs +39 -0
- package/views/menu/inventory.ejs +8 -0
- package/views/menu/more.ejs +5 -0
- package/views/menu/player.ejs +3 -0
- package/views/menu.ejs +20 -62
- package/views/scripts/base.js +314 -0
- package/controllers/spirits/attribute.js +0 -47
- package/controllers/spirits/inventory.js +0 -71
- package/controllers/spirits/item.js +0 -41
- package/controllers/spirits/serve.js +0 -33
- package/public/js/commune.js +0 -22
- package/public/js/establishment.js +0 -44
- package/public/js/memories.js +0 -44
- package/test/explorer/coast/tall-beach/nono-cove/local-scripts/game.js +0 -7
- package/test/explorer/coast/tall-beach/nono-cove/local-scripts/items.js +0 -162
- package/test/explorer/coast/tall-beach/nono-cove/server-scripts/getTimer.js +0 -31
- package/test/explorer/coast/tall-beach/nono-cove/styles/items-floor.css +0 -92
- package/test/explorer/coast/tall-beach/nono-cove/views/index.ejs +0 -130
- package/test/pages/server-scripts/emailTime.js +0 -15
- package/test/the-front/server-scripts/emailTime.js +0 -15
- package/test/the-front/server-scripts/getTimer.js +0 -31
- package/test/the-front/views/check.ejs +0 -93
- package/test/the-front/views/index.ejs +0 -113
- package/test/void/styles/void.css +0 -0
- package/views/account.ejs +0 -122
- package/views/inventory.ejs +0 -117
- package/views/more.ejs +0 -16
- package/views/player.ejs +0 -60
package/models/user.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import Spirit from "./spirit.js";
|
|
2
|
+
import Item from "./item.js";
|
|
3
|
+
import bcrypt from "bcrypt";
|
|
4
|
+
|
|
5
|
+
export default class User extends Spirit {
|
|
6
|
+
static recallOne = async (target = null, username = null, id = null) => {
|
|
7
|
+
let spirit = new User(target, id);
|
|
8
|
+
|
|
9
|
+
let query = null;
|
|
10
|
+
|
|
11
|
+
if (target) {
|
|
12
|
+
query = Spirit.buildQuery({
|
|
13
|
+
route: "/",
|
|
14
|
+
service: "user",
|
|
15
|
+
scope: "global",
|
|
16
|
+
parent: null
|
|
17
|
+
}, { email: target });
|
|
18
|
+
}
|
|
19
|
+
else if (username) {
|
|
20
|
+
query = Spirit.buildQuery({
|
|
21
|
+
route: "/",
|
|
22
|
+
service: "user",
|
|
23
|
+
scope: "global",
|
|
24
|
+
parent: null
|
|
25
|
+
}, { username: username });
|
|
26
|
+
}
|
|
27
|
+
else if (id) {
|
|
28
|
+
query = Spirit.buildQuery({
|
|
29
|
+
route: "/",
|
|
30
|
+
service: "user",
|
|
31
|
+
scope: "global",
|
|
32
|
+
parent: null
|
|
33
|
+
}, null, id);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let found = null;
|
|
37
|
+
|
|
38
|
+
if (query) found = await Spirit.db.findOne(query);
|
|
39
|
+
|
|
40
|
+
if (found) {
|
|
41
|
+
spirit.memory = found;
|
|
42
|
+
spirit.id = found._id;
|
|
43
|
+
|
|
44
|
+
return spirit;
|
|
45
|
+
}
|
|
46
|
+
else return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static create = async (username, password, email) => {
|
|
50
|
+
let spirit = new User(email);
|
|
51
|
+
|
|
52
|
+
const salt = await bcrypt.genSalt(10);
|
|
53
|
+
const hash = await bcrypt.hash(password, salt);
|
|
54
|
+
|
|
55
|
+
spirit.memory = await Spirit.db.create({
|
|
56
|
+
route: "/",
|
|
57
|
+
service: "user",
|
|
58
|
+
scope: "global",
|
|
59
|
+
parent: null,
|
|
60
|
+
_lastUpdate: Date.now(),
|
|
61
|
+
data: {
|
|
62
|
+
username: username,
|
|
63
|
+
password: hash,
|
|
64
|
+
email: email,
|
|
65
|
+
resetToken: null,
|
|
66
|
+
resetExp: null,
|
|
67
|
+
coin: 0,
|
|
68
|
+
home: "/",
|
|
69
|
+
authLevels: [ "Basic" ],
|
|
70
|
+
location: "/the-front",
|
|
71
|
+
attributes: {
|
|
72
|
+
translation: 0,
|
|
73
|
+
strength: 0,
|
|
74
|
+
agility: 0,
|
|
75
|
+
defense: 0
|
|
76
|
+
},
|
|
77
|
+
inventory: []
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return spirit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static delete = async (target) => {
|
|
85
|
+
let found = await Spirit.db.findAndDelete(Spirit.buildQuery({
|
|
86
|
+
route: "/",
|
|
87
|
+
service: "user",
|
|
88
|
+
scope: "global",
|
|
89
|
+
parent: null
|
|
90
|
+
}, { email: target }));
|
|
91
|
+
|
|
92
|
+
return found.deletedCount;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
constructor(email, id = null) {
|
|
96
|
+
super();
|
|
97
|
+
this.email = email;
|
|
98
|
+
this.id = id;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
offsetItem = async (name, offset) => {
|
|
102
|
+
let item = Item.recallOne(name);
|
|
103
|
+
|
|
104
|
+
if (!item) return "Item not found in database.";
|
|
105
|
+
|
|
106
|
+
let inv = this.memory.data.inventory;
|
|
107
|
+
|
|
108
|
+
let holding = false;
|
|
109
|
+
|
|
110
|
+
for (let j = 0; j < inv.length; j++) {
|
|
111
|
+
if (inv[j].name === name) {
|
|
112
|
+
holding = true;
|
|
113
|
+
|
|
114
|
+
if (inv[j].amount >= -Math.floor(offset)) {
|
|
115
|
+
inv[j].amount += Math.floor(offset);
|
|
116
|
+
|
|
117
|
+
if (inv[j].amount === 0) {
|
|
118
|
+
let empty = inv[j];
|
|
119
|
+
|
|
120
|
+
inv.splice(j, 1);
|
|
121
|
+
|
|
122
|
+
this.memory._lastUpdate = Date.now();
|
|
123
|
+
await this.commit();
|
|
124
|
+
|
|
125
|
+
return "Item emptied.";
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.memory._lastUpdate = Date.now();
|
|
129
|
+
await this.commit();
|
|
130
|
+
|
|
131
|
+
return inv[j];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return `Unable to remove ${-offset} ${name}
|
|
136
|
+
from inventory because the inventory has only ${inv[j].amount}.`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!holding) {
|
|
142
|
+
if (offset > 0) {
|
|
143
|
+
inv.push({
|
|
144
|
+
name: name,
|
|
145
|
+
amount: offset
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
this.memory._lastUpdate = Date.now();
|
|
149
|
+
|
|
150
|
+
await this.commit();
|
|
151
|
+
|
|
152
|
+
return inv[inv.length - 1];
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return `Unable to remove ${-offset} ${name}
|
|
156
|
+
from inventory because the inventory has none.`;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
checkAttribute = async (check, against) => {
|
|
162
|
+
let att = this.memory.data.attributes;
|
|
163
|
+
|
|
164
|
+
return att[check] >= against;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
setAttribute = async (change, to) => {
|
|
168
|
+
let att = this.memory.data.attributes;
|
|
169
|
+
|
|
170
|
+
att[change] = to;
|
|
171
|
+
this.memory._lastUpdate = Date.now();
|
|
172
|
+
await this.commit();
|
|
173
|
+
|
|
174
|
+
return "Attributes set.";
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
incrementAttribute = async (change, max) => {
|
|
178
|
+
let att = this.memory.data.attributes;
|
|
179
|
+
|
|
180
|
+
if (att[change] < max) {
|
|
181
|
+
att[change]++;
|
|
182
|
+
this.memory._lastUpdate = Date.now();
|
|
183
|
+
await this.commit();
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return att[change];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
package/notherbase-fs.js
CHANGED
package/package.json
CHANGED
package/public/styles/main.css
CHANGED
|
@@ -42,7 +42,7 @@ body {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
main {
|
|
45
|
-
width:
|
|
45
|
+
width: 800px;
|
|
46
46
|
min-height: 500px;
|
|
47
47
|
box-shadow: 5px 5px 5px 5px var(--shadowColor);
|
|
48
48
|
padding: 20px;
|
|
@@ -64,7 +64,7 @@ footer {
|
|
|
64
64
|
align-content: center;
|
|
65
65
|
align-items: flex-start;
|
|
66
66
|
min-height: 25px;
|
|
67
|
-
width:
|
|
67
|
+
width: 800px;
|
|
68
68
|
background-color: var(--veryDarkBgColor);
|
|
69
69
|
border-radius: 0px 0px 5px 5px;
|
|
70
70
|
box-shadow: 5px 5px 5px 5px var(--shadowColor);
|
|
@@ -127,6 +127,15 @@ input[type=submit]:hover, button:hover, a:hover {
|
|
|
127
127
|
cursor: pointer;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
.header-link {
|
|
131
|
+
border: none;
|
|
132
|
+
padding: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.header-link:hover {
|
|
136
|
+
border: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
130
139
|
.login-cover {
|
|
131
140
|
position: absolute;
|
|
132
141
|
left: 0;
|
|
@@ -135,7 +144,7 @@ input[type=submit]:hover, button:hover, a:hover {
|
|
|
135
144
|
height: 100%;
|
|
136
145
|
}
|
|
137
146
|
|
|
138
|
-
@media only screen and (max-width:
|
|
147
|
+
@media only screen and (max-width: 800px) {
|
|
139
148
|
main {
|
|
140
149
|
width: 100%;
|
|
141
150
|
}
|
package/test/{explorer/coast/tall-beach/nono-cove/styles → coast/tall-beach/nono-cove}/index.css
RENAMED
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
nono
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<hr>
|
|
6
|
+
|
|
7
|
+
<h3>chat</h3>
|
|
8
|
+
|
|
9
|
+
<div class="chat-box" id="test-chat"></div>
|
|
10
|
+
<div class="chat-box" id="test-chat-2"></div>
|
|
11
|
+
<div class="chat-box" id="test-chat-3"></div>
|
|
12
|
+
|
|
13
|
+
<hr>
|
|
14
|
+
|
|
15
|
+
<a href="/the-front" class="to">
|
|
16
|
+
Go to The Front
|
|
17
|
+
</a>
|
|
18
|
+
|
|
19
|
+
<a href="/coast/tall-beach/nono-cove/nono-og" class="to">
|
|
20
|
+
Go to Nono Cove
|
|
21
|
+
</a>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script src="/js/chat-box.js"></script>
|
|
25
|
+
<script>
|
|
26
|
+
let chatTest = new ChatBox("<%= user.username %>", "test-chat");
|
|
27
|
+
let chatTest2 = new ChatBox("<%= user.username %>", "test-chat-2");
|
|
28
|
+
let chatTest3 = new ChatBox("<%= user.username %>", "test-chat-3");
|
|
29
|
+
</script>
|
|
File without changes
|
|
@@ -64,7 +64,7 @@ class NonoGame {
|
|
|
64
64
|
this.$board.css("width", this.dimensions[0] * (tileSize) + this.nonoSize + 5);
|
|
65
65
|
this.$board.css("height", this.dimensions[1] * (tileSize) + this.nonoSize + 5);
|
|
66
66
|
|
|
67
|
-
let $nono = this.$board.append(`<img class="nono" src="/img/
|
|
67
|
+
let $nono = this.$board.append(`<img class="nono" src="/img/logo.png">`).children().last();
|
|
68
68
|
$nono.css("width", this.nonoSize);
|
|
69
69
|
$nono.css("height", this.nonoSize);
|
|
70
70
|
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export default async (req, user) => {
|
|
2
|
+
let gold = await req.db.Item.recallOne("Gold Coin");
|
|
3
|
+
if (!gold) {
|
|
4
|
+
//console.log(gold);
|
|
5
|
+
await req.db.Item.create("Gold Coin", "Gold Coin", "Long Gold Coin");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
await user.offsetItem("Gold Coin", 15);
|
|
9
|
+
|
|
10
|
+
let local = await req.db.Spirit.recallOrCreate({
|
|
11
|
+
route: req.body.route,
|
|
12
|
+
scope: "local",
|
|
13
|
+
parent: user.id,
|
|
14
|
+
service: "gold"
|
|
15
|
+
}, {}, {
|
|
16
|
+
gold: 0
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (!local.memory.data.gold) local.memory.data.gold = 0;
|
|
20
|
+
local.memory.data.gold += 15;
|
|
21
|
+
await local.commit();
|
|
22
|
+
|
|
23
|
+
let global = await req.db.Spirit.recallOrCreate({
|
|
24
|
+
route: req.body.route,
|
|
25
|
+
scope: "global",
|
|
26
|
+
parent: null,
|
|
27
|
+
service: "gold"
|
|
28
|
+
}, {}, {
|
|
29
|
+
gold: 0
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (!global.memory.data.gold) global.memory.data.gold = 0;
|
|
33
|
+
global.memory.data.gold += 15;
|
|
34
|
+
await global.commit();
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<h1>The Big Check</h1>
|
|
2
|
+
|
|
3
|
+
<hr>
|
|
4
|
+
|
|
5
|
+
<button onclick="base.do('add-more-gold')">+3</button>
|
|
6
|
+
<button onclick="base.do('subtract-gold')">-30</button>
|
|
7
|
+
<button onclick="base.do('emailTime')">email</button>
|
|
8
|
+
|
|
9
|
+
<hr>
|
|
10
|
+
|
|
11
|
+
<a href="/the-front">
|
|
12
|
+
Go to The Front
|
|
13
|
+
</a>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default async function emailTime(req, user) {
|
|
2
|
+
let goldCheck = req.db.Item.recall("Gold Coin");
|
|
3
|
+
|
|
4
|
+
if (!goldCheck) req.db.Item.create("Gold Coin", "Gold Coin Short", "Gold Coin Long");
|
|
5
|
+
|
|
6
|
+
let inv = user.memory.data.inventory;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
return "Sent";
|
|
11
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<h1>NotherBase</h1>
|
|
2
|
+
|
|
3
|
+
<p>
|
|
4
|
+
Welcome to The Front Test.
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p id="gold">0 Gold Added</p>
|
|
8
|
+
|
|
9
|
+
<hr>
|
|
10
|
+
|
|
11
|
+
<h3>Test Accounts</h3>
|
|
12
|
+
<button onclick="test.runTest()">Run Test</button>
|
|
13
|
+
|
|
14
|
+
<p id="info"></p>
|
|
15
|
+
|
|
16
|
+
<input type="number" id="token">
|
|
17
|
+
<button onclick="test.continueTest()">Continue Test</button>
|
|
18
|
+
<button onclick="base.do('incTranslation')">inc trans</button>
|
|
19
|
+
|
|
20
|
+
<hr>
|
|
21
|
+
|
|
22
|
+
<a href="/coast/tall-beach/nono-cove" class="to nother-base">
|
|
23
|
+
Go inside
|
|
24
|
+
</a>
|
|
25
|
+
|
|
26
|
+
<a href="/the-front/check">
|
|
27
|
+
Go to The Check
|
|
28
|
+
</a>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
class Test {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.$info = $("main #info");
|
|
34
|
+
this.$gold = $("#gold");
|
|
35
|
+
|
|
36
|
+
this.oldID = Math.floor(Math.random() * 1000);
|
|
37
|
+
this.oldUsername = `testuser${this.oldID}`;
|
|
38
|
+
this.oldEmail = `${this.oldID}@testmail.com`;
|
|
39
|
+
this.oldPassword = `${this.oldID}password`;
|
|
40
|
+
|
|
41
|
+
this.newID = Math.floor(Math.random() * 1000);
|
|
42
|
+
this.newUsername = `testuser${this.newID}`;
|
|
43
|
+
this.newEmail = `${this.newID}@testmail.com`;
|
|
44
|
+
this.newPassword = `${this.newID}password`;
|
|
45
|
+
|
|
46
|
+
this.prepTest();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
prepTest = async () => {
|
|
50
|
+
this.$info.empty();
|
|
51
|
+
|
|
52
|
+
this.$info.append(this.oldUsername + "<br>");
|
|
53
|
+
this.$info.append(this.oldEmail + "<br>");
|
|
54
|
+
this.$info.append(this.oldPassword + "<br>");
|
|
55
|
+
|
|
56
|
+
this.$info.append(this.newUsername + "<br>");
|
|
57
|
+
this.$info.append(this.newEmail + "<br>");
|
|
58
|
+
this.$info.append(this.newPassword + "<br>");
|
|
59
|
+
|
|
60
|
+
let loaded = await base.load("gold", "global");
|
|
61
|
+
this.$gold.text(`?/${loaded.gold ? loaded.gold : 0} Gold Added`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
runTest = async () => {
|
|
65
|
+
let response = await base.attemptRegister(
|
|
66
|
+
this.oldEmail,
|
|
67
|
+
this.oldUsername,
|
|
68
|
+
this.oldPassword
|
|
69
|
+
);
|
|
70
|
+
this.$info.append(response.message + "<br>");
|
|
71
|
+
|
|
72
|
+
response = await base.attemptLogin(this.oldEmail, this.oldPassword);
|
|
73
|
+
this.$info.append(response.message + "<br>");
|
|
74
|
+
|
|
75
|
+
response = await base.do("add-gold", null, "/the-front");
|
|
76
|
+
this.$info.append(response.message + "<br>");
|
|
77
|
+
|
|
78
|
+
let amountLocal = await base.load("gold");
|
|
79
|
+
let amountGlobal = await base.load("gold", "global");
|
|
80
|
+
this.$gold.text(`${amountLocal.gold}/${amountGlobal.gold} Gold Added`);
|
|
81
|
+
|
|
82
|
+
response = await base.resetPassword(this.oldEmail, true);
|
|
83
|
+
this.$info.append(response.message + "<br>");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
continueTest = async () => {
|
|
87
|
+
let response = await base.logout();
|
|
88
|
+
this.$info.append(response.message + "<br>");
|
|
89
|
+
|
|
90
|
+
response = await base.changePassword(
|
|
91
|
+
$("#token").val(),
|
|
92
|
+
this.oldEmail,
|
|
93
|
+
this.newPassword,
|
|
94
|
+
this.newPassword
|
|
95
|
+
);
|
|
96
|
+
this.$info.append(response.message + "<br>");
|
|
97
|
+
|
|
98
|
+
response = await base.attemptLogin(this.oldEmail, this.newPassword);
|
|
99
|
+
this.$info.append(response.message + "<br>");
|
|
100
|
+
|
|
101
|
+
response = await base.logout();
|
|
102
|
+
this.$info.append(response.message + "<br>");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let test = new Test();
|
|
107
|
+
</script>
|
package/test/void/index.ejs
CHANGED
package/views/explorer.ejs
CHANGED
|
@@ -1,64 +1,55 @@
|
|
|
1
1
|
<%- include("./head.ejs"); %>
|
|
2
2
|
|
|
3
|
+
<script src="/socket.io/socket.io.js"></script>
|
|
4
|
+
|
|
5
|
+
<div class="ui">
|
|
6
|
+
<%- include("./menu.ejs", {user: user}); %>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
3
9
|
<script>
|
|
4
10
|
const currentRoute = "<%- route %>";
|
|
11
|
+
|
|
12
|
+
<%- include("./scripts/base.js", {user: user}); %>
|
|
5
13
|
</script>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<script src="/js/memories.js"></script>
|
|
9
|
-
<script src="/js/establishment.js"></script>
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
|
|
11
17
|
<main class="override">
|
|
12
18
|
<% if (requireUser && !user) { %>
|
|
13
19
|
<div class="login-cover">
|
|
14
|
-
<a href="/">
|
|
20
|
+
<a class="header-link" href="/">
|
|
15
21
|
<h1>NotherBase</h1>
|
|
16
22
|
</a>
|
|
17
23
|
<h3>Login to Your Account</h3>
|
|
18
24
|
<input type="email" placeholder="user@email.com" id="email">
|
|
19
25
|
<input type="password" placeholder="password" id="pass">
|
|
20
|
-
<button id="login" onclick="
|
|
21
|
-
<button id="reset" onclick="
|
|
26
|
+
<button id="login" onclick="coverLogin()">Login</button>
|
|
27
|
+
<button id="reset" onclick="coverReset()">Reset Password</button>
|
|
22
28
|
<p class="info"></p>
|
|
23
|
-
</div>
|
|
24
|
-
<script>
|
|
25
|
-
const $loginEmail = $(".login-cover #email");
|
|
26
|
-
const $loginPassword = $(".login-cover #pass");
|
|
27
|
-
const $loginInfo = $(".login-cover .info");
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
location.reload();
|
|
40
|
-
}
|
|
41
|
-
else $loginInfo.text(data.message);
|
|
42
|
-
});
|
|
43
|
-
};
|
|
30
|
+
<script>
|
|
31
|
+
const coverLogin = async () => {
|
|
32
|
+
let response = await base.attemptLogin(
|
|
33
|
+
$(".login-cover #email").val(),
|
|
34
|
+
$(".login-cover #pass").val()
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
if (response.status === "success") location.reload();
|
|
38
|
+
$(".login-cover .info").text(response.data);
|
|
39
|
+
};
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</script>
|
|
41
|
+
const coverReset = async () => {
|
|
42
|
+
let response = await base.resetPassword(
|
|
43
|
+
$(".login-cover #email").val()
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
$(".login-cover .info").text(response.data);
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
</div>
|
|
55
50
|
<% } else { %>
|
|
56
51
|
<%- include(`${main}.ejs`); %>
|
|
57
52
|
<% } %>
|
|
58
53
|
</main>
|
|
59
54
|
|
|
60
|
-
<div class="ui">
|
|
61
|
-
<%- include("./menu.ejs", {user: user}); %>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
55
|
<%- include("./footer.ejs"); %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<div id="account" class="invisible content">
|
|
2
|
+
<p id="please-login">Please login to view your account settings.</p>
|
|
3
|
+
|
|
4
|
+
<div class="invisible settings">
|
|
5
|
+
<h3>Email:</h3>
|
|
6
|
+
<div class="setting" id="email">
|
|
7
|
+
<p></p>
|
|
8
|
+
<button onclick="base.playerAccount.editEmail()">Change Email</button>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="edit invisible" id="email">
|
|
11
|
+
<input type="email" name="email">
|
|
12
|
+
<button onclick="base.playerAccount.updateEmail()">Update</button>
|
|
13
|
+
<button onclick="base.playerAccount.cancelEmail()">Cancel</button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<hr>
|
|
17
|
+
|
|
18
|
+
<h3>Username:</h3>
|
|
19
|
+
<div class="setting" id="username">
|
|
20
|
+
<p></p>
|
|
21
|
+
<button onclick="base.playerAccount.editUsername()">Change Username</button>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="edit invisible" id="username">
|
|
24
|
+
<input type="text" name="username">
|
|
25
|
+
<button onclick="base.playerAccount.updateUsername()">Update</button>
|
|
26
|
+
<button onclick="base.playerAccount.cancelUsername()">Cancel</button>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<hr>
|
|
30
|
+
|
|
31
|
+
<h3>Password:</h3>
|
|
32
|
+
<div class="setting" id="password">
|
|
33
|
+
<p>*********</p>
|
|
34
|
+
<p>Visit the Keeper to Change Your Password</p>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<p id="info"></p>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|