@adminforth/two-factors-auth 1.0.30 → 1.0.31
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/Changelog.md +6 -0
- package/custom/TwoFactorsSetup.vue +3 -0
- package/dist/custom/TwoFactorsSetup.vue +3 -0
- package/dist/index.js +2 -2
- package/index.ts +2 -2
- package/package.json +1 -1
package/Changelog.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -109,10 +109,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
109
109
|
return { status: 'error', message: 'Invalid token' };
|
|
110
110
|
}
|
|
111
111
|
if (decoded.newSecret) {
|
|
112
|
-
const verified = decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
112
|
+
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
113
113
|
if (verified) {
|
|
114
114
|
this.connectors = this.adminforth.connectors;
|
|
115
|
-
if (!
|
|
115
|
+
if (!body.skip) {
|
|
116
116
|
const connector = this.connectors[this.authResource.dataSource];
|
|
117
117
|
yield connector.updateRecord({ resource: this.authResource, recordId: decoded.pk, newValues: { [this.options.twoFaSecretFieldName]: decoded.newSecret } });
|
|
118
118
|
}
|
package/index.ts
CHANGED
|
@@ -117,10 +117,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
117
117
|
return {status:'error',message:'Invalid token'}
|
|
118
118
|
}
|
|
119
119
|
if (decoded.newSecret) {
|
|
120
|
-
const verified = decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
120
|
+
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
121
121
|
if (verified) {
|
|
122
122
|
this.connectors = this.adminforth.connectors
|
|
123
|
-
if (!
|
|
123
|
+
if (!body.skip) {
|
|
124
124
|
const connector = this.connectors[this.authResource.dataSource];
|
|
125
125
|
await connector.updateRecord({resource:this.authResource, recordId:decoded.pk, newValues:{[this.options.twoFaSecretFieldName]: decoded.newSecret}})
|
|
126
126
|
}
|