daveappserver 0.6.0 → 0.6.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/appserver.js +18 -14
- package/package.json +1 -1
package/appserver.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myVersion = "0.6.
|
|
1
|
+
var myVersion = "0.6.1", myProductName = "daveAppServer";
|
|
2
2
|
|
|
3
3
|
exports.start = startup;
|
|
4
4
|
exports.notifySocketSubscribers = notifySocketSubscribers;
|
|
@@ -979,26 +979,30 @@ function cleanFileStats (stats) { //4/19/21 by DW
|
|
|
979
979
|
}
|
|
980
980
|
function receiveConfirmation (emailConfirmCode, callback) {
|
|
981
981
|
const urlWebApp = "http://" + config.myDomain + "/";
|
|
982
|
-
var urlRedirect = undefined;
|
|
982
|
+
var urlRedirect = undefined, flFoundConfirm = false;
|
|
983
983
|
stats.pendingConfirmations.forEach (function (item) {
|
|
984
984
|
if (item.magicString == emailConfirmCode) {
|
|
985
|
-
console.log (utils.jsonStringify (item));
|
|
986
|
-
|
|
987
|
-
|
|
988
985
|
if (config.addEmailToUserInDatabase !== undefined) {
|
|
989
|
-
config.addEmailToUserInDatabase (item.screenname, item.email, item.magicString)
|
|
986
|
+
config.addEmailToUserInDatabase (item.screenname, item.email, item.magicString, function (err, emailSecret) {
|
|
987
|
+
if (err) {
|
|
988
|
+
urlRedirect = urlWebApp + "?failedLogin=true&message=" + encodeURIComponent (err.message);
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
urlRedirect = urlWebApp + "?emailconfirmed=true&email=" + item.email + "&code=" + encodeURIComponent (emailSecret);
|
|
992
|
+
item.flDeleted = true;
|
|
993
|
+
}
|
|
994
|
+
callback (urlRedirect);
|
|
995
|
+
});
|
|
990
996
|
}
|
|
991
|
-
|
|
992
|
-
urlRedirect = urlWebApp + "?emailconfirmed=true&email=" + item.email + "&code=" + item.magicString;
|
|
993
|
-
|
|
994
|
-
item.flDeleted = true;
|
|
997
|
+
flFoundConfirm = true;
|
|
995
998
|
}
|
|
996
999
|
});
|
|
997
|
-
if (
|
|
998
|
-
urlRedirect
|
|
1000
|
+
if (!flFoundConfirm) {
|
|
1001
|
+
if (urlRedirect === undefined) {
|
|
1002
|
+
urlRedirect = urlWebApp + "?failedLogin=true&message=" + encodeURIComponent ("Can't find the pending confirmation.");
|
|
1003
|
+
}
|
|
1004
|
+
callback (urlRedirect);
|
|
999
1005
|
}
|
|
1000
|
-
console.log ("receiveConfirmation: urlRedirect == " + urlRedirect);
|
|
1001
|
-
callback (urlRedirect);
|
|
1002
1006
|
}
|
|
1003
1007
|
function checkPendingConfirmations () {
|
|
1004
1008
|
var flChanged = false;
|