Activities of "vd"

Answer

Hi,

could you please check this if it helps you
https://support.abp.io/QA/Questions/4484/Allow-Guest-user-to-use-certain-application-services-served-by-a-guest-page#answer-562eec34-7eec-073f-0829-3a092fd6770f

Right now, I'm trying to avoid refreshing the page in Angular. This link is not about Angular.

For instance, when changing the language in any abp project, the texts are replaced without the page needing to refresh. How is it done ?

Answer

hi as a workaround, can you do something like this? With this method, you won't need to reload the page.

export class AppComponent { 
  config = inject(ConfigStateService); 
  authService = inject(AuthService); 
  router = inject(Router); 
 
  constructor() { 
    const currentUser = this.config.getOne('currentUser'); 
 
    if (currentUser == null || currentUser.id == null) { 
      const loginParams: LoginParams = { 
        username: 'admin', // change with your username 
        password: '1q2w3E*', // change with your password 
        redirectUrl: '/', 
      }; 
      this.router.navigateByUrl('/account/login').then(() => { 
        this.authService 
          .login(loginParams) 
          .subscribe(); 
      }); 
    } 
  } 
} 

Thanks but with your workaround, the login page is displayed for 1-2 seconds before being redirected to the main page. Seeing the login page for a few seconds before it disappears is confusing for the user.

Answer

Hi,

I'm using Angular with Resource Owner Password Flow so I don't think changing Login.cshtml will help me.

Besides, the public login should occur automatically when opening any page of the application. Not only the login page.

Question
  • ABP Framework version: v7.4.4
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Auth Server Separated (for Angular): no

I'm trying to implement public user automatic authentication (for permission management). When users access the website, I want them to be automatically connected under a single "public" user.

I tried this in app.component :

ngOnInit(): void {
        
        //...
        
        const currentUser = this.config.getOne("currentUser");

        if(currentUser == null || currentUser.id == null){
            const loginParams: LoginParams = {
                username: 'public',
                password: '**********'
            }
            this.authService.login(loginParams).subscribe(
                () => {
                    window.location.reload();
                }
            );
        }
    }

window.location.reload() is currently necessary to refresh the top right menu. If I don't reload the page, upon clicking on the user menu I get an error :

app.component.ts:38 ERROR TypeError: Cannot read properties of undefined (reading 'toggle')
    at ToolbarContainerComponent.toggleCtxMenu (volosoft-ngx-lepton-x-layouts.mjs:373:22)
    at ToolbarContainerComponent_Template_lpx_toolbar_profileClick_0_listener (volosoft-ngx-lepton-x-layouts.mjs:377:362)
    at executeListenerWithErrorHandling (core.mjs:16195:16)
    at Object.wrapListenerIn_markDirtyAndPreventDefault [as next] (core.mjs:16228:22)
    at ConsumerObserver.next (Subscriber.js:91:33)
    at SafeSubscriber._next (Subscriber.js:60:26)
    at SafeSubscriber.next (Subscriber.js:31:18)
    at Subject.js:34:30
    at errorContext (errorContext.js:19:9)
    at EventEmitter_.next (Subject.js:27:21)

How can I avoid reloading the page ?

I also tried moving the authentication code to an APP_INITIALIZER in app.module, but then, the authService is not yet initialized

Hi,

I have the exact same issue as 5179 (same abp version, angular, same configuration, same reproduce steps)

I see that you closed it without providing a solution. Is there a solution ?

Showing 21 to 25 of 25 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37