Skip to content

Commit d89d047

Browse files
committed
fix: update processLoginCallbacks to use sessionDuration instead of rememberMeDays
1 parent 49f9a34 commit d89d047

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

adminforth/modules/restApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
123123
this.adminforth = adminforth;
124124
}
125125

126-
async processLoginCallbacks(adminUser: AdminUser, toReturn: { redirectTo?: string, allowedLogin:boolean, error?: string }, response: any, extra: HttpExtra, rememberMeDays?: number) {
126+
async processLoginCallbacks(adminUser: AdminUser, toReturn: { redirectTo?: string, allowedLogin:boolean, error?: string }, response: any, extra: HttpExtra, sessionDuration?: number) {
127127
const beforeLoginConfirmation = this.adminforth.config.auth.beforeLoginConfirmation as (BeforeLoginConfirmationFunction[] | undefined);
128128

129129
for (const hook of listify(beforeLoginConfirmation)) {
@@ -132,7 +132,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
132132
response,
133133
adminforth: this.adminforth,
134134
extra,
135-
rememberMeDays
135+
sessionDuration,
136136
});
137137

138138
if (resp?.body?.redirectTo || resp?.error) {

adminforth/types/Back.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,9 @@ export interface IAdminForthRestAPI {
331331
* @param adminUser - plugin/af pases current adminUser
332332
* @param toReturn - this is an object which will get status of login process. If at least one callback returns error or redirectTo, login process will be stopped (future callbacks will not be called).
333333
* @param response - http response object
334+
* @param sessionDuration - duration of session in days
334335
*/
335-
processLoginCallbacks(adminUser: AdminUser, toReturn: { redirectTo?: string, allowedLogin: boolean, error?: string }, response: any, extra: HttpExtra): Promise<void>;
336+
processLoginCallbacks(adminUser: AdminUser, toReturn: { redirectTo?: string, allowedLogin: boolean, error?: string }, response: any, extra: HttpExtra, sessionDuration?: number): Promise<void>;
336337
}
337338

338339
export interface IAdminForth {
@@ -604,7 +605,7 @@ export type BeforeLoginConfirmationFunction = (params?: {
604605
response: IAdminForthHttpResponse,
605606
adminforth: IAdminForth,
606607
extra?: HttpExtra,
607-
rememberMeDays?: number,
608+
sessionDuration?: number,
608609
}) => Promise<{
609610
error?: string,
610611
body: {

0 commit comments

Comments
 (0)