@@ -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 ) {
126+ async processLoginCallbacks ( adminUser : AdminUser , toReturn : { redirectTo ?: string , allowedLogin :boolean , error ?: string } , response : any , extra : HttpExtra , rememberMeDays ?: number ) {
127127 const beforeLoginConfirmation = this . adminforth . config . auth . beforeLoginConfirmation as ( BeforeLoginConfirmationFunction [ ] | undefined ) ;
128128
129129 for ( const hook of listify ( beforeLoginConfirmation ) ) {
@@ -132,6 +132,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
132132 response,
133133 adminforth : this . adminforth ,
134134 extra,
135+ rememberMeDays
135136 } ) ;
136137
137138 if ( resp ?. body ?. redirectTo || resp ?. error ) {
@@ -197,10 +198,16 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
197198 pk : userRecord [ userResource . columns . find ( ( col ) => col . primaryKey ) . name ] ,
198199 username,
199200 } ;
200- await this . processLoginCallbacks ( adminUser , toReturn , response , { body, headers, query, cookies, requestUrl } ) ;
201+
202+ const expireInDays = rememberMe ? this . adminforth . config . auth . rememberMeDays || 30 : 1 ;
203+
204+
205+ await this . processLoginCallbacks ( adminUser , toReturn , response , {
206+ body, headers, query, cookies, requestUrl,
207+ } , expireInDays ) ;
201208
202209 if ( toReturn . allowedLogin ) {
203- const expireInDays = rememberMe && this . adminforth . config . auth . rememberMeDays ;
210+
204211 this . adminforth . auth . setAuthCookie ( {
205212 expireInDays,
206213 response,
0 commit comments