Base solution for your next web application
Open Closed

Login From Public Website #6536


User avatar
0
ogrodski created

I am using the ASP.NET Core & Angular 7 solution.

When I click on the Login link from the public website, the system redirects me to "http://localhost:4200/account/login?ss=true&returnUrl=http://localhost:45776/Account/Login" which displays the Angular app login. Then, when I login, the sytems redirects back to the public website Account controller, as per the returnUrl, which then redirects me back to the public website home page by default.

After login, I would like to redirect to a page in the Angular app based on the user's role or user preference.

Is this currently possible? If so, where is it documented how to do this? Any suggetions would be appreciated.

Thanks,

Al


5 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Do it in the Account controller, as you have found.

  • User Avatar
    0
    ogrodski created

    How does the system currenlty know what page to display after a user logins?

    It looks like the 'admin" user shows the Dashboard, but if I create another user, the Notifications page displays.

  • User Avatar
    0
    aaron created
    Support Team

    It's determined by selectBestRoute in auth-route-guard.ts.

  • User Avatar
    0
    ogrodski created

    Thanks. I now see how the initial page is determined based on the following logic:

        selectBestRoute(): string {
    
            if (this._permissionChecker.isGranted('Pages.Administration.Host.Dashboard')) {
                return '/app/admin/hostDashboard';
            }
    
            if (this._permissionChecker.isGranted('Pages.Tenant.Dashboard')) {
                return '/app/main/dashboard';
            }
    
            return '/app/notifications';
        }
    

    Unfortunately, this requires a code change if you need to add a new or different route (i.e., initial page). It would be nice if there was the ability to assign the initial page to a Role and/or User using the Admin UI. Is it possible to put this on the roadmap?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Unfortunately, this requires a code change if you need to add a new or different route (i.e., initial page). It would be nice if there was the ability to assign the initial page to a Role and/or User using the Admin UI. Is it possible to put this on the roadmap?

    @ogrodski unfortunately, there is no such feature right now.