Skip to content

Commit b5c6f80

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents d212c14 + 5bc3665 commit b5c6f80

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

adminforth/modules/restApi.ts

Lines changed: 10 additions & 3 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) {
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,

adminforth/spa/src/afcl/Tooltip.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
<teleport to="body" v-if="showTooltip">
66
<div
77
role="tooltip"
8-
class="absolute z-20 invisible inline-block px-3 py-2 text-sm font-medium text-lightTooltipText dark:darkTooltipText transition-opacity duration-300 bg-lightTooltipBackground rounded-lg shadow-sm opacity-0 tooltip dark:bg-darkTooltipBackground"
8+
class="absolute z-[100] invisible inline-block px-3 py-2 text-sm font-medium text-lightTooltipText dark:darkTooltipText transition-opacity duration-300 bg-lightTooltipBackground rounded-lg shadow-sm opacity-0 tooltip dark:bg-darkTooltipBackground"
99
ref="tooltip"
1010
>
1111
<slot name="tooltip"></slot>
12-
<div class="tooltip-arrow" data-popper-arrow></div>
12+
<div class="tooltip-arrow absolute -top-2" data-popper-arrow>
13+
<div class="absolute top-0 -left-0.5 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent border-b-lightTooltipBackground dark:border-b-darkTooltipBackground"></div>
14+
</div>
1315
</div>
1416
</teleport>
1517
</template>

adminforth/types/Back.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ export type BeforeLoginConfirmationFunction = (params?: {
603603
response: IAdminForthHttpResponse,
604604
adminforth: IAdminForth,
605605
extra?: HttpExtra,
606+
rememberMeDays?: number,
606607
}) => Promise<{
607608
error?: string,
608609
body: {

0 commit comments

Comments
 (0)