shogun-core 6.0.3 → 6.1.0
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/dist/browser/shogun-core.js +40 -19
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/gundb/db.js +40 -19
- package/dist/index.esm.js +28 -0
- package/dist/types/interfaces/shogun.d.ts +3 -0
- package/package.json +4 -4
|
@@ -144804,15 +144804,9 @@ class DataBase {
|
|
|
144804
144804
|
}
|
|
144805
144805
|
// Set the user instance
|
|
144806
144806
|
this.user = this.gun.user();
|
|
144807
|
-
// Run post-authentication tasks
|
|
144808
|
-
|
|
144809
|
-
|
|
144810
|
-
// Return the post-auth result which includes the complete user data
|
|
144811
|
-
return postAuthResult;
|
|
144812
|
-
}
|
|
144813
|
-
catch (postAuthError) {
|
|
144814
|
-
console.error(`Post-auth error: ${postAuthError}`);
|
|
144815
|
-
// Even if post-auth fails, the user was created and authenticated successfully
|
|
144807
|
+
// Run post-authentication tasks (optional)
|
|
144808
|
+
if (this.core?.config?.postAuth?.enabled === false) {
|
|
144809
|
+
// Skip post-auth tasks and return minimal success result
|
|
144816
144810
|
return {
|
|
144817
144811
|
success: true,
|
|
144818
144812
|
userPub: authResult.userPub,
|
|
@@ -144828,6 +144822,31 @@ class DataBase {
|
|
|
144828
144822
|
: undefined,
|
|
144829
144823
|
};
|
|
144830
144824
|
}
|
|
144825
|
+
else {
|
|
144826
|
+
try {
|
|
144827
|
+
const postAuthResult = await this.runPostAuthOnAuthResult(username, authResult.userPub, authResult);
|
|
144828
|
+
// Return the post-auth result which includes the complete user data
|
|
144829
|
+
return postAuthResult;
|
|
144830
|
+
}
|
|
144831
|
+
catch (postAuthError) {
|
|
144832
|
+
console.error(`Post-auth error: ${postAuthError}`);
|
|
144833
|
+
// Even if post-auth fails, the user was created and authenticated successfully
|
|
144834
|
+
return {
|
|
144835
|
+
success: true,
|
|
144836
|
+
userPub: authResult.userPub,
|
|
144837
|
+
username: username,
|
|
144838
|
+
isNewUser: true,
|
|
144839
|
+
sea: this.gun.user()?._?.sea
|
|
144840
|
+
? {
|
|
144841
|
+
pub: this.gun.user()._?.sea.pub,
|
|
144842
|
+
priv: this.gun.user()._?.sea.priv,
|
|
144843
|
+
epub: this.gun.user()._?.sea.epub,
|
|
144844
|
+
epriv: this.gun.user()._?.sea.epriv,
|
|
144845
|
+
}
|
|
144846
|
+
: undefined,
|
|
144847
|
+
};
|
|
144848
|
+
}
|
|
144849
|
+
}
|
|
144831
144850
|
}
|
|
144832
144851
|
catch (error) {
|
|
144833
144852
|
console.error(`Exception during signup for ${username}: ${error}`);
|
|
@@ -145669,16 +145688,18 @@ class DataBase {
|
|
|
145669
145688
|
error: "Authentication failed: No user pub returned.",
|
|
145670
145689
|
};
|
|
145671
145690
|
}
|
|
145672
|
-
// Esegui post-authentication tasks
|
|
145673
|
-
|
|
145674
|
-
|
|
145675
|
-
|
|
145676
|
-
|
|
145677
|
-
|
|
145678
|
-
|
|
145679
|
-
|
|
145680
|
-
|
|
145681
|
-
|
|
145691
|
+
// Esegui post-authentication tasks (opzionali)
|
|
145692
|
+
if (this.core?.config?.postAuth?.enabled !== false) {
|
|
145693
|
+
try {
|
|
145694
|
+
await this.runPostAuthOnAuthResult(alias, userPub, {
|
|
145695
|
+
success: true,
|
|
145696
|
+
userPub: userPub,
|
|
145697
|
+
});
|
|
145698
|
+
}
|
|
145699
|
+
catch (postAuthError) {
|
|
145700
|
+
console.error(`Post-auth error during login: ${postAuthError}`);
|
|
145701
|
+
// Continue with login even if post-auth fails
|
|
145702
|
+
}
|
|
145682
145703
|
}
|
|
145683
145704
|
// Update user's last seen timestamp
|
|
145684
145705
|
try {
|