strapi-plugin-magic-link-v5 4.16.0 → 4.16.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/README.md +2 -2
- package/dist/server/index.js +25 -3
- package/dist/server/index.mjs +25 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Magic Link - Passwordless Authentication for Strapi v5
|
|
2
2
|
|
|
3
|
-
Secure passwordless authentication for Strapi using email-based magic links.
|
|
3
|
+
Secure passwordless authentication for Strapi v5 using email-based magic links. Simple, secure, and user-friendly - no passwords required.
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://www.npmjs.com/package/strapi-plugin-magic-link-v5)
|
|
@@ -44,7 +44,7 @@ This plugin is licensed under the **MIT License** - free for everyone to use!
|
|
|
44
44
|
## ✨ Features
|
|
45
45
|
|
|
46
46
|
### Core Authentication
|
|
47
|
-
- 🔐 **Passwordless Login** - Users log in via secure email links
|
|
47
|
+
- 🔐 **Passwordless Login** - Users log in via secure email magic links
|
|
48
48
|
- 🎫 **Magic Link Tokens** - Cryptographically secure, time-limited tokens
|
|
49
49
|
- 🔑 **JWT Session Management** - Monitor and manage active user sessions
|
|
50
50
|
- 👤 **Auto User Creation** - Optionally create users automatically on first login
|
package/dist/server/index.js
CHANGED
|
@@ -239,6 +239,27 @@ Thanks.`,
|
|
|
239
239
|
} catch (error2) {
|
|
240
240
|
strapi2.log.error("❌ Error initializing License Guard:", error2);
|
|
241
241
|
}
|
|
242
|
+
try {
|
|
243
|
+
setTimeout(async () => {
|
|
244
|
+
const usersToUpdate = await strapi2.db.query("plugin::users-permissions.user").findMany({
|
|
245
|
+
where: { provider: "magic-link" },
|
|
246
|
+
select: ["id", "email"]
|
|
247
|
+
});
|
|
248
|
+
if (usersToUpdate && usersToUpdate.length > 0) {
|
|
249
|
+
strapi2.log.info('🔄 [Magic-Link Migration] Found %d user(s) with old provider "magic-link"', usersToUpdate.length);
|
|
250
|
+
await strapi2.db.query("plugin::users-permissions.user").updateMany({
|
|
251
|
+
where: { provider: "magic-link" },
|
|
252
|
+
data: { provider: "local" }
|
|
253
|
+
});
|
|
254
|
+
strapi2.log.info('✅ [Magic-Link Migration] Updated %d user(s) to provider "local"', usersToUpdate.length);
|
|
255
|
+
strapi2.log.info(" Users can now login with both Magic-Link AND Email/Password! 🎉");
|
|
256
|
+
} else {
|
|
257
|
+
strapi2.log.info('✅ [Magic-Link Migration] All users already using provider "local" - no migration needed');
|
|
258
|
+
}
|
|
259
|
+
}, 5e3);
|
|
260
|
+
} catch (error2) {
|
|
261
|
+
strapi2.log.error("❌ [Magic-Link Migration] Error updating providers:", error2);
|
|
262
|
+
}
|
|
242
263
|
};
|
|
243
264
|
var destroy$1 = ({ strapi: strapi2 }) => {
|
|
244
265
|
try {
|
|
@@ -23119,7 +23140,8 @@ var tokens$1 = {
|
|
|
23119
23140
|
username,
|
|
23120
23141
|
email: email2,
|
|
23121
23142
|
password,
|
|
23122
|
-
provider: "
|
|
23143
|
+
provider: "local",
|
|
23144
|
+
// Use 'local' so users can login with email/password AND magic-link
|
|
23123
23145
|
confirmed: true,
|
|
23124
23146
|
// Auto-confirm the user
|
|
23125
23147
|
blocked: false,
|
|
@@ -23858,8 +23880,8 @@ var license$1 = {
|
|
|
23858
23880
|
}
|
|
23859
23881
|
},
|
|
23860
23882
|
/**
|
|
23861
|
-
|
|
23862
|
-
|
|
23883
|
+
* Store and validate an existing license key
|
|
23884
|
+
*/
|
|
23863
23885
|
async storeKey(ctx) {
|
|
23864
23886
|
try {
|
|
23865
23887
|
const { licenseKey, email: email2 } = ctx.request.body;
|
package/dist/server/index.mjs
CHANGED
|
@@ -207,6 +207,27 @@ Thanks.`,
|
|
|
207
207
|
} catch (error2) {
|
|
208
208
|
strapi2.log.error("❌ Error initializing License Guard:", error2);
|
|
209
209
|
}
|
|
210
|
+
try {
|
|
211
|
+
setTimeout(async () => {
|
|
212
|
+
const usersToUpdate = await strapi2.db.query("plugin::users-permissions.user").findMany({
|
|
213
|
+
where: { provider: "magic-link" },
|
|
214
|
+
select: ["id", "email"]
|
|
215
|
+
});
|
|
216
|
+
if (usersToUpdate && usersToUpdate.length > 0) {
|
|
217
|
+
strapi2.log.info('🔄 [Magic-Link Migration] Found %d user(s) with old provider "magic-link"', usersToUpdate.length);
|
|
218
|
+
await strapi2.db.query("plugin::users-permissions.user").updateMany({
|
|
219
|
+
where: { provider: "magic-link" },
|
|
220
|
+
data: { provider: "local" }
|
|
221
|
+
});
|
|
222
|
+
strapi2.log.info('✅ [Magic-Link Migration] Updated %d user(s) to provider "local"', usersToUpdate.length);
|
|
223
|
+
strapi2.log.info(" Users can now login with both Magic-Link AND Email/Password! 🎉");
|
|
224
|
+
} else {
|
|
225
|
+
strapi2.log.info('✅ [Magic-Link Migration] All users already using provider "local" - no migration needed');
|
|
226
|
+
}
|
|
227
|
+
}, 5e3);
|
|
228
|
+
} catch (error2) {
|
|
229
|
+
strapi2.log.error("❌ [Magic-Link Migration] Error updating providers:", error2);
|
|
230
|
+
}
|
|
210
231
|
};
|
|
211
232
|
var destroy$1 = ({ strapi: strapi2 }) => {
|
|
212
233
|
try {
|
|
@@ -23087,7 +23108,8 @@ var tokens$1 = {
|
|
|
23087
23108
|
username,
|
|
23088
23109
|
email: email2,
|
|
23089
23110
|
password,
|
|
23090
|
-
provider: "
|
|
23111
|
+
provider: "local",
|
|
23112
|
+
// Use 'local' so users can login with email/password AND magic-link
|
|
23091
23113
|
confirmed: true,
|
|
23092
23114
|
// Auto-confirm the user
|
|
23093
23115
|
blocked: false,
|
|
@@ -23826,8 +23848,8 @@ var license$1 = {
|
|
|
23826
23848
|
}
|
|
23827
23849
|
},
|
|
23828
23850
|
/**
|
|
23829
|
-
|
|
23830
|
-
|
|
23851
|
+
* Store and validate an existing license key
|
|
23852
|
+
*/
|
|
23831
23853
|
async storeKey(ctx) {
|
|
23832
23854
|
try {
|
|
23833
23855
|
const { licenseKey, email: email2 } = ctx.request.body;
|
package/package.json
CHANGED