@adminforth/two-factors-auth 4.4.7 → 4.4.8
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.
|
@@ -38,7 +38,7 @@ export function createTwoFaHandlers(ctx) {
|
|
|
38
38
|
yield ctx.totpService.saveSecret(decoded.pk, decoded.newSecret);
|
|
39
39
|
}
|
|
40
40
|
ctx.cookieService.removeTotpTemporary(response);
|
|
41
|
-
ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
41
|
+
yield ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
42
42
|
return { status: 'ok', allowedLogin: true };
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
@@ -69,7 +69,7 @@ export function createTwoFaHandlers(ctx) {
|
|
|
69
69
|
}
|
|
70
70
|
if (verified) {
|
|
71
71
|
ctx.cookieService.removeTotpTemporary(response);
|
|
72
|
-
ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
72
|
+
yield ctx.cookieService.setAuthCookie({ expireInDuration: decoded.sessionDuration, response, username: decoded.userName, pk: decoded.pk });
|
|
73
73
|
return { status: 'ok', allowedLogin: true };
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
@@ -120,7 +120,7 @@ export function createTwoFaHandlers(ctx) {
|
|
|
120
120
|
},
|
|
121
121
|
}, expireInDuration);
|
|
122
122
|
if (toReturn.allowedLogin === true) {
|
|
123
|
-
ctx.cookieService.setAuthCookie({
|
|
123
|
+
yield ctx.cookieService.setAuthCookie({
|
|
124
124
|
response,
|
|
125
125
|
username,
|
|
126
126
|
pk: userPk,
|
|
@@ -30,7 +30,7 @@ export declare class CookieService {
|
|
|
30
30
|
username: string;
|
|
31
31
|
pk: string;
|
|
32
32
|
expireInDuration: string;
|
|
33
|
-
}):
|
|
33
|
+
}): Promise<string>;
|
|
34
34
|
getTotpTemporary(cookies: CookieList): string | null;
|
|
35
35
|
verifyTotpTemporary(cookies: CookieList): Promise<TotpTemporaryPayload | null>;
|
|
36
36
|
setTotpTemporary(response: IAdminForthHttpResponse, payload: TotpTemporaryPayload): void;
|
|
@@ -23,7 +23,7 @@ export class CookieService {
|
|
|
23
23
|
return this.adminforth.auth.getCustomCookie({ cookies, name: AUTH_COOKIE });
|
|
24
24
|
}
|
|
25
25
|
setAuthCookie(opts) {
|
|
26
|
-
this.adminforth.auth.setAuthCookie(opts);
|
|
26
|
+
return this.adminforth.auth.setAuthCookie(opts);
|
|
27
27
|
}
|
|
28
28
|
getTotpTemporary(cookies) {
|
|
29
29
|
return this.adminforth.auth.getCustomCookie({ cookies, name: TOTP_TEMP_COOKIE });
|
|
@@ -32,7 +32,7 @@ export function createTwoFaHandlers(ctx: any) {
|
|
|
32
32
|
await ctx.totpService.saveSecret(decoded.pk, decoded.newSecret);
|
|
33
33
|
}
|
|
34
34
|
ctx.cookieService.removeTotpTemporary(response)
|
|
35
|
-
ctx.cookieService.setAuthCookie({expireInDuration: decoded.sessionDuration, response, username:decoded.userName, pk:decoded.pk})
|
|
35
|
+
await ctx.cookieService.setAuthCookie({expireInDuration: decoded.sessionDuration, response, username:decoded.userName, pk:decoded.pk})
|
|
36
36
|
return { status: 'ok', allowedLogin: true }
|
|
37
37
|
} else {
|
|
38
38
|
return respondWithStatus({ error: 'Wrong or expired OTP code' }, response, HttpStatus.FORBIDDEN)
|
|
@@ -61,7 +61,7 @@ export function createTwoFaHandlers(ctx: any) {
|
|
|
61
61
|
}
|
|
62
62
|
if (verified) {
|
|
63
63
|
ctx.cookieService.removeTotpTemporary(response)
|
|
64
|
-
ctx.cookieService.setAuthCookie({expireInDuration: decoded.sessionDuration, response, username:decoded.userName, pk:decoded.pk})
|
|
64
|
+
await ctx.cookieService.setAuthCookie({expireInDuration: decoded.sessionDuration, response, username:decoded.userName, pk:decoded.pk})
|
|
65
65
|
return { status: 'ok', allowedLogin: true }
|
|
66
66
|
} else {
|
|
67
67
|
return respondWithStatus({ error: verificationError }, response, HttpStatus.FORBIDDEN)
|
|
@@ -124,7 +124,7 @@ export function createTwoFaHandlers(ctx: any) {
|
|
|
124
124
|
);
|
|
125
125
|
|
|
126
126
|
if ( toReturn.allowedLogin === true ) {
|
|
127
|
-
ctx.cookieService.setAuthCookie({
|
|
127
|
+
await ctx.cookieService.setAuthCookie({
|
|
128
128
|
response,
|
|
129
129
|
username,
|
|
130
130
|
pk: userPk,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/two-factors-auth",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.8",
|
|
4
4
|
"description": "AdminForth plugin for two factors authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"zod": "^4.3.6"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"adminforth": "^3.
|
|
32
|
+
"adminforth": "^3.31.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.10.7",
|
|
36
|
-
"adminforth": "^3.
|
|
36
|
+
"adminforth": "^3.31.5",
|
|
37
37
|
"semantic-release": "^24.2.1",
|
|
38
38
|
"semantic-release-slack-bot": "^4.0.2",
|
|
39
39
|
"typescript": "^5.7.3"
|
|
@@ -43,8 +43,8 @@ export class CookieService {
|
|
|
43
43
|
return this.adminforth.auth.getCustomCookie({ cookies, name: AUTH_COOKIE });
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
public setAuthCookie(opts: { response: IAdminForthHttpResponse; username: string; pk: string; expireInDuration: string }):
|
|
47
|
-
this.adminforth.auth.setAuthCookie(opts);
|
|
46
|
+
public setAuthCookie(opts: { response: IAdminForthHttpResponse; username: string; pk: string; expireInDuration: string }): Promise<string> {
|
|
47
|
+
return this.adminforth.auth.setAuthCookie(opts);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
public getTotpTemporary(cookies: CookieList): string | null {
|