Base solution for your next web application
Open Closed

Upon session expire: wants to control "Current User Did Not Login To Application" message and its redirected action. #10107


User avatar
0
demo.solaru created

Hello,

When .Net Core is not able to validate token: it throws this error message and automatically reloads page on Angular.

  1. Wants to change verbaige of this message: "Current User Did Not Login To Application" -- I already tried changing it in .xml file for localization but its not overridding.
  2. After token expiry I don't want anguler to auto reload the page but let user click on "Ok" button and then wants to reload the page.

Using Aspnetzero 7.0.0.

Any help would be appriciated. Thank you!

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    1
    ismcagdas created
    Support Team

    Hi,

    1. This message is defined in https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Localization/Sources/AbpXmlSource/Abp.xml#L15. So you need to override it as explained here
    2. This is handled here https://github.com/aspnetboilerplate/abp-ng2-module/blob/master/projects/abp-ng2-module/src/lib/interceptors/abp-http-configuration.service.ts#L58. You can override it as shown below;

    import { AbpHttpConfigurationService } from 'abp-ng2-module';

    @Injectable()
    export class HttpConfigurationService extends AbpHttpConfigurationService {
        handleUnAuthorizedRequest(messagePromise: any, targetUrl?: string) {
            const self = this;
    
            if (messagePromise) {
                messagePromise.done(() => {
                    this.handleTargetUrl(targetUrl || '/');
                });
            } else {
                self.handleTargetUrl(targetUrl || '/');
            }
        }
    }
    

    and replace in the app;

     providers: [{provide: AbpHttpConfigurationService, useClass: HttpConfigurationService}],
    
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    demo.solaru created

    Thank you @ismcagdas

    Just a one more question: where we need to add " providers: [{provide: AbpHttpConfigurationService, useClass: HttpConfigurationService}]," ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @demo.solaru

    You can do it in the app module.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)