daveappserver 0.6.17 → 0.6.20
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/appserver.js +15 -9
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.6.
|
|
1
|
+
var myVersion = "0.6.20", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -64,6 +64,8 @@ var config = {
|
|
|
64
64
|
|
|
65
65
|
flSecureWebsocket: false, //2/8/23 by DW
|
|
66
66
|
|
|
67
|
+
flUseS3ForStorage: false, //2/15/23 by DW
|
|
68
|
+
|
|
67
69
|
isUserInDatabase: function (screenname, callback) { //2/6/23 by DW
|
|
68
70
|
callback (false);
|
|
69
71
|
},
|
|
@@ -1004,7 +1006,8 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
1004
1006
|
});
|
|
1005
1007
|
}
|
|
1006
1008
|
//email registration -- 12/7/22 by DW
|
|
1007
|
-
function sendConfirmingEmail (email, screenname, flNewUser=false, callback) {
|
|
1009
|
+
function sendConfirmingEmail (email, screenname, flNewUser=false, urlRedirect, callback) {
|
|
1010
|
+
email = utils.stringLower (email); //3/8/23 by DW
|
|
1008
1011
|
function getScreenname (callback) {
|
|
1009
1012
|
if (flNewUser) { //the caller had to provide it
|
|
1010
1013
|
config.isUserInDatabase (screenname, function (flInDatabase) {
|
|
@@ -1035,6 +1038,7 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
1035
1038
|
flDeleted: false,
|
|
1036
1039
|
screenname,
|
|
1037
1040
|
flNewUser, //1/7/23 by DW
|
|
1041
|
+
urlRedirect, //3/3/23 by DW
|
|
1038
1042
|
when: new Date ()
|
|
1039
1043
|
};
|
|
1040
1044
|
stats.pendingConfirmations.push (obj);
|
|
@@ -1072,8 +1076,7 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
1072
1076
|
});
|
|
1073
1077
|
}
|
|
1074
1078
|
function receiveConfirmation (emailConfirmCode, callback) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1079
|
+
var urlWebApp = config.urlServerForClient; //2/5/23 by DW
|
|
1077
1080
|
var urlRedirect = undefined, flFoundConfirm = false;
|
|
1078
1081
|
function encode (s) {
|
|
1079
1082
|
return (encodeURIComponent (s));
|
|
@@ -1081,6 +1084,9 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
1081
1084
|
stats.pendingConfirmations.forEach (function (item) {
|
|
1082
1085
|
if (item.magicString == emailConfirmCode) {
|
|
1083
1086
|
if (config.addEmailToUserInDatabase !== undefined) {
|
|
1087
|
+
if (item.urlRedirect !== undefined) { //3/3/23 by DW
|
|
1088
|
+
urlWebApp = item.urlRedirect;
|
|
1089
|
+
}
|
|
1084
1090
|
config.addEmailToUserInDatabase (item.screenname, item.email, item.magicString, item.flNewUser, function (err, emailSecret) {
|
|
1085
1091
|
if (err) {
|
|
1086
1092
|
urlRedirect = urlWebApp + "?failedLogin=true&message=" + encode (err.message);
|
|
@@ -1337,7 +1343,6 @@ function startup (options, callback) {
|
|
|
1337
1343
|
}
|
|
1338
1344
|
}
|
|
1339
1345
|
function callWithScreenname (callback) {
|
|
1340
|
-
|
|
1341
1346
|
if (config.flUseTwitterIdentity) { //2/6/23 by DW
|
|
1342
1347
|
if (config.getScreenname === undefined) {
|
|
1343
1348
|
davetwitter.getScreenName (token, secret, function (screenname) {
|
|
@@ -1362,10 +1367,11 @@ function startup (options, callback) {
|
|
|
1362
1367
|
}
|
|
1363
1368
|
else {
|
|
1364
1369
|
if ((params.emailaddress !== undefined) && (params.emailcode !== undefined)) {
|
|
1365
|
-
|
|
1370
|
+
const email = utils.stringLower (params.emailaddress); //3/8/23 by DW
|
|
1371
|
+
config.isUserInDatabase (email, function (flInDatabase, userRec) {
|
|
1366
1372
|
if (flInDatabase) {
|
|
1367
1373
|
if (params.emailcode == userRec.emailSecret) {
|
|
1368
|
-
callback (
|
|
1374
|
+
callback (email);
|
|
1369
1375
|
}
|
|
1370
1376
|
else {
|
|
1371
1377
|
const message = "Can't do what you wanted the correct email authentication wasn't provided.";
|
|
@@ -1548,10 +1554,10 @@ function startup (options, callback) {
|
|
|
1548
1554
|
});
|
|
1549
1555
|
return (true);
|
|
1550
1556
|
case "/sendconfirmingemail": //12/7/22 by DW
|
|
1551
|
-
sendConfirmingEmail (params.email, undefined, false, httpReturn);
|
|
1557
|
+
sendConfirmingEmail (params.email, undefined, false, params.urlredirect, httpReturn); //3/3/23 by DW
|
|
1552
1558
|
return (true);
|
|
1553
1559
|
case "/createnewuser": //1/7/23 by DW
|
|
1554
|
-
sendConfirmingEmail (params.email, params.name, true, httpReturn);
|
|
1560
|
+
sendConfirmingEmail (params.email, params.name, true, params.urlredirect, httpReturn); //3/3/23 by DW
|
|
1555
1561
|
return (true);
|
|
1556
1562
|
case "/userconfirms": //12/7/22 by DW
|
|
1557
1563
|
receiveConfirmation (params.emailConfirmCode, httpReturnRedirect);
|