@@ -210,12 +210,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
210210 const resource = this . adminforth . config . resources . find ( ( res ) => res . resourceId === this . adminforth . config . auth . usersResourceId ) ;
211211 const usernameColumn = resource . columns . find ( ( col ) => col . name === usernameField ) ;
212212
213- let loginPromptHTML ;
214- if ( typeof this . adminforth . config . auth . loginPromptHTML === 'function' ) {
215- loginPromptHTML = await this . adminforth . config . auth . loginPromptHTML ( ) ;
216- } else {
217- loginPromptHTML = this . adminforth . config . auth . loginPromptHTML ;
218- }
213+ let loginPromptHTML = await getLoginPromptHTML ( this . adminforth . config . auth . loginPromptHTML ) ;
219214
220215 return {
221216 brandName : this . adminforth . config . customization . brandName ,
@@ -234,7 +229,17 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
234229 } ,
235230 } ) ;
236231
237-
232+ async function getLoginPromptHTML ( prompt ) {
233+ if ( typeof prompt === 'function' ) {
234+ const result = await prompt ( ) ;
235+ if ( result !== undefined ) {
236+ return result ;
237+ }
238+ return "" ;
239+ } else {
240+ return prompt ;
241+ }
242+ }
238243 server . endpoint ( {
239244 method : 'GET' ,
240245 path : '/get_base_config' ,
@@ -298,12 +303,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
298303
299304 const announcementBadge : AnnouncementBadgeResponse = this . adminforth . config . customization . announcementBadge ?.( adminUser ) ;
300305
301- let loginPromptHTML ;
302- if ( typeof this . adminforth . config . auth . loginPromptHTML === 'function' ) {
303- loginPromptHTML = await this . adminforth . config . auth . loginPromptHTML ( ) ;
304- } else {
305- loginPromptHTML = this . adminforth . config . auth . loginPromptHTML ;
306- }
306+ let loginPromptHTML = await getLoginPromptHTML ( this . adminforth . config . auth . loginPromptHTML ) ;
307307
308308
309309 const publicPart = {
0 commit comments