shogun-core 1.3.2 → 1.3.3
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.
|
@@ -1045,16 +1045,19 @@ class GunInstance {
|
|
|
1045
1045
|
async forgotPassword(username, securityAnswers) {
|
|
1046
1046
|
(0, logger_1.log)("Attempting password recovery for:", username);
|
|
1047
1047
|
try {
|
|
1048
|
-
// Find the user's
|
|
1049
|
-
const
|
|
1050
|
-
if (!
|
|
1048
|
+
// Find the user's data
|
|
1049
|
+
const userData = await this.checkUsernameExists(username);
|
|
1050
|
+
if (!userData || !userData.pub) {
|
|
1051
1051
|
return { success: false, error: "User not found" };
|
|
1052
1052
|
}
|
|
1053
|
-
//
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1053
|
+
// Extract the public key from user data
|
|
1054
|
+
const userPub = userData.pub;
|
|
1055
|
+
(0, logger_1.log)(`Found user public key for password recovery: ${userPub}`);
|
|
1056
|
+
// Access the user's security data directly from their public key node
|
|
1057
|
+
// Security data is stored in the user's private space, so we need to access it via their public key
|
|
1056
1058
|
const securityData = await new Promise((resolve) => {
|
|
1057
|
-
|
|
1059
|
+
this.gun.get(userPub).get("security").once((data) => {
|
|
1060
|
+
(0, logger_1.log)(`Retrieved security data for user ${username}:`, data ? "found" : "not found");
|
|
1058
1061
|
resolve(data);
|
|
1059
1062
|
});
|
|
1060
1063
|
});
|