Piranha.core: Redirect after successful manager login

Created on 31 Jan 2020  路  9Comments  路  Source: PiranhaCMS/piranha.core

Is it possible to change the deafult redirect without changing the source code of the page? If not, what is the best practice?
Maybe I need to create a new login page in my custom module and set up page redirection?

_PS: I have user roles for which the ability to view site pages should be closed._

Default Login page redirect (RedirectToPageResult("PageList")):

public async Task<IActionResult> OnPostAsync(InputModel model)
{
    if (!ModelState.IsValid)
    {
        return Page();
    }

    if (await _service.SignIn(HttpContext, model.Username, model.Password))
    {
        return new RedirectToPageResult("PageList");
    }
    return Page();
}

Regards.

bug core-manager

All 9 comments

Hi there! Luckily this is already implemented here:

https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha.Manager/Areas/Manager/Pages/Index.cshtml.cs#L33

Unfortunately the redirect after login hasn't been updated correctly. We'll fix the redirect for the 8.1 release which will be out any day now!

Cool! Thank you)

By the way, where can I find an example of how to set the right page for redirection?

The code will redirect the user to the first page in the menu he/she has access to. If the user doesn鈥檛 have access to anything in the manager he/she will be logged out.

Regards

So to clarify, there's no way atm to specify that a specific user should have a certain start page in the manager.

I think this is not a problem. By the way, is it possible to create a common page at the very top of the hierarchy (for example, a welcome page as start page) so that all users have access to it?

@chybyk Are we still talking about the manager? If so, yes just insert a page at the start of the menu. Atm all page needs to be contained within a group, but we could change that for the upcoming version.

This is what it would look like if we added support for navigable first level items in the menu (The top item). I'll run it by @NJepop to see what he thinks.

Sk盲rmavbild 2020-02-03 kl  19 57 09

For my purposes, what you showed me before is enough. But perhaps in some cases it would be more convenient.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rengert picture rengert  路  3Comments

stefanolsenn picture stefanolsenn  路  4Comments

mtlc1402 picture mtlc1402  路  5Comments

stefanolsenn picture stefanolsenn  路  3Comments

SamBray picture SamBray  路  3Comments