Base solution for your next web application
Open Closed

remove tenant from the login screen - You are not logged in as a host user! #10855


User avatar
0
kylem created
  • What is your product version? 11.0.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hi,

We decided to remove tenant from the login screen and followed your instruction about from: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Core-Angular-Sign-In-Without-Specifying-Tenant

It mostly went well, our users have unique emails andlogging in with emails works file. We configured logging in via Ldap for some tenatns, and this works fine as well.

There was however one issue:

when I logged in as a host admin, I would be logged in correctly but I was not able to use "Tenants -> Login as this Tenant" functionality. I was getting "You are not logged in as a host user!"

I dig up a bit, and found the error in tenants.components.ts in showUserImpersonateLookUpModal(record: any) method.

I commented out the check that caused the error, and thigs seem ok now, but I wanted to check with you guys if this is right way:

showUserImpersonateLookUpModal(record: any): void {
        // if (abp.multiTenancy.getTenantIdCookie()) {
        //     this.message.warn(this.l('YouAreNotLoggedInAsAHostUser')).then(() => {
        //         document.location.reload();
        //     });

        //     return;
        // }

        this.impersonateUserLookupModal.tenantId = record.id;
        this.impersonateUserLookupModal.show();
    }

Thanks, Predrag


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kylem

    This if statement checks if a tenant user is logged in or not, so it is correct. Could you share the result of abp.multiTenancy.getTenantIdCookie() when you login as a host user ? You can write this statement to browser console and execute it.

  • User Avatar
    0
    kylem created

    As you can see on the screenshot, the value is 2 which corresponds to globex tenant. Initially it worked, but once I was logged in as globex tenant and I went back to Host it is still showing TenandId cookie to be 2.

    I tried logging in using both id (admin) or email ([email protected]) and in both cases I am getting same error

  • User Avatar
    0
    kylem created

    Me again :) I tried one more time to fix it, this time by deleting cookie in logout() and backToMyAccount() methods of user-menu.component.ts and firsts test looked good. Is this better?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kylem

    Yes, this is definitely better :).

  • User Avatar
    0
    kylem created

    Thanks. Than I guess we can close this ticket. Maybe, you guys can update the instructions for removing tenant from the login screen based on this ticket? For us, not forcing users to select tenant on the login is very useful feature from user experience point. Regards, Predrag

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kylem

    Thanks, we will update the document.