@adminforth/two-factors-auth 2.9.17 → 2.9.19
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/index.js +4 -4
- package/index.ts +4 -4
- package/package.json +2 -2
- package/types.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -394,7 +394,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
394
394
|
yield connector.updateRecord({ resource: this.authResource, recordId: decoded.pk, newValues: { [this.options.twoFaSecretFieldName]: decoded.newSecret } });
|
|
395
395
|
}
|
|
396
396
|
this.adminforth.auth.removeCustomCookie({ response, name: '2FaTemporaryJWT' });
|
|
397
|
-
this.adminforth.auth.setAuthCookie({
|
|
397
|
+
this.adminforth.auth.setAuthCookie({ expireInDuration: decoded.rememberMeDays, response, username: decoded.userName, pk: decoded.pk });
|
|
398
398
|
return { status: 'ok', allowedLogin: true };
|
|
399
399
|
}
|
|
400
400
|
else {
|
|
@@ -428,7 +428,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
428
428
|
}
|
|
429
429
|
if (verified) {
|
|
430
430
|
this.adminforth.auth.removeCustomCookie({ response, name: '2FaTemporaryJWT' });
|
|
431
|
-
this.adminforth.auth.setAuthCookie({
|
|
431
|
+
this.adminforth.auth.setAuthCookie({ expireInDuration: decoded.rememberMeDays, response, username: decoded.userName, pk: decoded.pk });
|
|
432
432
|
return { status: 'ok', allowedLogin: true };
|
|
433
433
|
}
|
|
434
434
|
else {
|
|
@@ -505,13 +505,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
505
505
|
meta: {
|
|
506
506
|
loginAllowedByPasskeyDirectSignIn: true
|
|
507
507
|
},
|
|
508
|
-
});
|
|
508
|
+
}, rememberMe ? this.adminforth.config.auth.rememberMeDuration || '30d' : '1d');
|
|
509
509
|
if (toReturn.allowedLogin === true) {
|
|
510
510
|
this.adminforth.auth.setAuthCookie({
|
|
511
511
|
response,
|
|
512
512
|
username,
|
|
513
513
|
pk: user.id,
|
|
514
|
-
|
|
514
|
+
expireInDuration: this.options.passkeys.rememberDaysAfterPasskeyLogin ? this.options.passkeys.rememberDaysAfterPasskeyLogin : this.adminforth.config.auth.rememberMeDuration,
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
517
|
return toReturn;
|
package/index.ts
CHANGED
|
@@ -437,7 +437,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
437
437
|
await connector.updateRecord({resource:this.authResource, recordId:decoded.pk, newValues:{[this.options.twoFaSecretFieldName]: decoded.newSecret}})
|
|
438
438
|
}
|
|
439
439
|
this.adminforth.auth.removeCustomCookie({response, name:'2FaTemporaryJWT'})
|
|
440
|
-
this.adminforth.auth.setAuthCookie({
|
|
440
|
+
this.adminforth.auth.setAuthCookie({expireInDuration: decoded.rememberMeDays, response, username:decoded.userName, pk:decoded.pk})
|
|
441
441
|
return { status: 'ok', allowedLogin: true }
|
|
442
442
|
} else {
|
|
443
443
|
return {error: 'Wrong or expired OTP code'}
|
|
@@ -468,7 +468,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
468
468
|
}
|
|
469
469
|
if (verified) {
|
|
470
470
|
this.adminforth.auth.removeCustomCookie({response, name:'2FaTemporaryJWT'})
|
|
471
|
-
this.adminforth.auth.setAuthCookie({
|
|
471
|
+
this.adminforth.auth.setAuthCookie({expireInDuration: decoded.rememberMeDays, response, username:decoded.userName, pk:decoded.pk})
|
|
472
472
|
return { status: 'ok', allowedLogin: true }
|
|
473
473
|
} else {
|
|
474
474
|
return {error: 'Verification failed'}
|
|
@@ -559,7 +559,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
559
559
|
loginAllowedByPasskeyDirectSignIn: true
|
|
560
560
|
},
|
|
561
561
|
},
|
|
562
|
-
|
|
562
|
+
rememberMe ? this.adminforth.config.auth.rememberMeDuration || '30d' : '1d',
|
|
563
563
|
|
|
564
564
|
);
|
|
565
565
|
|
|
@@ -568,7 +568,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
568
568
|
response,
|
|
569
569
|
username,
|
|
570
570
|
pk: user.id,
|
|
571
|
-
|
|
571
|
+
expireInDuration: this.options.passkeys.rememberDaysAfterPasskeyLogin ? this.options.passkeys.rememberDaysAfterPasskeyLogin : this.adminforth.config.auth.rememberMeDuration,
|
|
572
572
|
});
|
|
573
573
|
}
|
|
574
574
|
return toReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/two-factors-auth",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.19",
|
|
4
4
|
"description": "AdminForth plugin for two factors authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"node-2fa": "^2.0.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"adminforth": "
|
|
32
|
+
"adminforth": "next"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.10.7",
|
package/types.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type PluginOptions = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Remember user for number of days after login with Passkey, so that user won't be challenged with 2FA on every login.
|
|
37
37
|
*/
|
|
38
|
-
rememberDaysAfterPasskeyLogin?:
|
|
38
|
+
rememberDaysAfterPasskeyLogin?: string;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Order of "Continue with passkey" button in under login button injection
|