Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect after successful manager login #1019

Closed
chybyk opened this issue Jan 31, 2020 · 9 comments
Closed

Redirect after successful manager login #1019

chybyk opened this issue Jan 31, 2020 · 9 comments
Assignees
Milestone

Comments

@chybyk
Copy link

chybyk commented Jan 31, 2020

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.

@tidyui tidyui added this to the Version 8.1 milestone Jan 31, 2020
@tidyui
Copy link
Member

tidyui commented Jan 31, 2020

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!

@tidyui tidyui closed this as completed in 0cafc88 Jan 31, 2020
@tidyui tidyui self-assigned this Jan 31, 2020
@chybyk
Copy link
Author

chybyk commented Jan 31, 2020

Cool! Thank you)

@chybyk
Copy link
Author

chybyk commented Jan 31, 2020

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

@tidyui
Copy link
Member

tidyui commented Jan 31, 2020

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

Regards

@tidyui
Copy link
Member

tidyui commented Feb 1, 2020

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

@chybyk
Copy link
Author

chybyk commented Feb 3, 2020

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?

@tidyui
Copy link
Member

tidyui commented Feb 3, 2020

@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.

@tidyui
Copy link
Member

tidyui commented Feb 3, 2020

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

@chybyk
Copy link
Author

chybyk commented Feb 3, 2020

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

@tidyui tidyui changed the title Successful login redirection Redirect after loggin into the manager Feb 16, 2020
@tidyui tidyui changed the title Redirect after loggin into the manager Redirect after successful manager login Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants