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