Piranha.core: Unable to login to Manager

Created on 2 Feb 2019  路  14Comments  路  Source: PiranhaCMS/piranha.core

Cloned the latest version of PiranhaCMS (Version 5.3.1) and added the following 2 lines to the ConfigureServices method:

services.AddPiranhaEF(options=>
options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"]));

services.AddPiranhaIdentityWithSeed(options =>
options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"]));

When I run the app I can see the role 'SysAdmin' has been auto-created in table:
[Piranha].[dbo].[Piranha_Roles]

I can also see the user 'admin' has also been created in the table:
[Piranha].[dbo].[Piranha_Users]

I've cleared the browser cache and the URL is:
http://localhost:50366/manager/login?ReturnUrl=%2Fmanager%2Fpages

When I use admin/password to login in - the page clears down the data and does not show an error message!

AccessFailedCount=0
LockOutEnabled=false

question

Most helpful comment

Incognito works and I'm able to login - well done!!

However, when I create ANOTHER admin user and I login as normal with the new user name using standard chrome settings I get the same problem.

EDIT: After deleting all cookies for Piranha I was STILL getting the same issues until I searched for localhost cookies and deleted them - then I was able to login!!!

Browser Settings >> Advanced >> Content Settings >> Cookies >>See all cookies & site data
Then 'search cookies' = piranha & delete
Then 'search cookies' = localhost & delete
You should now be able to login

BTW thank you for the VERY prompt responses - gives me a lot of confidence in your product/service!

All 14 comments

After further investigations and debugging Login it looks like the problem is arising at:

    return RedirectToAction("List", "Page", new { pageId = "" });

Hi there! Are you using the correct DbContext for Identity so you鈥檙e not using SQLite migrations, see #496?

/H氓kan

Also, have you created an empty project or are you using the example project or templates?

We've updated the documentation with full docs on the Identity packages. Take a look at this and let me know if it helps you:

http://piranhacms.org/docs/components/authentication/identity-security

Regards

I've done both

I created an empty project and installed Piranha which created the MSSQL db correctly with the right files and seed data

I've also separately used the example project which again created the MSSQL db correctly with the right files and seed data

The login method is validating the login correctly, hence no error message, but it's not redirecting to the Manager/pages section

So the login method is working as expected but you鈥檙e not redirected. After login can you manually navigate to /manager/pages and see the sitemap?

These are the interesting lines for SQLServer (taken from the project for PiranhaCMS.org). There are more relevant lines, but these have to do with database access, manager and authentication.

Configure()

services.AddPiranhaEF(options => 
    options.UseSqlServer(Configuration.GetConnectionString(...)));
services.AddPiranhaIdentityWithSeed<IdentitySQLServerDb>(options => 
    options.UseSqlServer(Configuration.GetConnectionString(...)));
services.AddPiranhaManager();

ConfigureServices()

app.UseAuthentication();
app.UsePiranha();
app.UsePiranhaManager();
app.UseMvc(routes => 
{
    routes.MapRoute(
        name: "areaRoute",
        template: "{area:exists}/{controller}/{action}/{id?}",
        defaults: new { controller = "Home", action = "Index" });
    routes.MapRoute(
        name: "default",
        template: "{controller=home}/{action=index}/{id?}");
    });

Regards

My ConfigureServices:
services.AddPiranhaEF(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"])); services.AddPiranhaIdentityWithSeed<IdentitySQLServerDb>(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"])); services.AddPiranhaManager();

My Configure()
'
// Register middleware
app.UseStaticFiles();
app.UseAuthentication();
app.UsePiranha();
app.UsePiranhaManager();
app.UseMvc(routes =>{
routes.MapRoute(name: "areaRoute",
template: "{area:exists}/{controller}/{action}/{id?}",
defaults: new { controller = "Home", action = "Index" });
routes.MapRoute(
name: "default",
template: "{controller=home}/{action=index}/{id?}");
});
'

After login I CANNOT manually navigate to /manager/pages - it takes be back to the Login screen

I have talk to other who have been stuck in similar loop. In that case it was an old cookie in the browser that was the problem, form a early project running on localhost.
Have you tried login using an other browser or used the incognito mode in the browser to see if you can get to the sitemap view?

Your setup looks correct, given that you actually have more stuff in your Configure() which you also left out. If you're redirected back to login then your user doesn't have the right claims for accessing the manager, which is odd if you're using the standard seeded admin user. I'd have to go with Filip that there's something with the cookies lurking around in the browser.

Just rebooted and immediately compiled new project and still not able to login after compilation

Just noticed, if I use Internet Explorer or Edge as the default browser I am able to get to the Manager/pages section but not if I use Chrome (my default browser)

As we all use Chrome for development without issues, have you changed any settings in your browser? And I don鈥檛 think your error is related to SQL Server, I鈥檓 guessing you get the same behavior with SQLite?

Please try using Incognito mode in Chrome (CTRL + SHIFT + N, on Windows) and see if you can log in. Or just try to clear all site data in the browser, it sure sounds like some old cookie lying and lurking somewhere.

Incognito works and I'm able to login - well done!!

However, when I create ANOTHER admin user and I login as normal with the new user name using standard chrome settings I get the same problem.

EDIT: After deleting all cookies for Piranha I was STILL getting the same issues until I searched for localhost cookies and deleted them - then I was able to login!!!

Browser Settings >> Advanced >> Content Settings >> Cookies >>See all cookies & site data
Then 'search cookies' = piranha & delete
Then 'search cookies' = localhost & delete
You should now be able to login

BTW thank you for the VERY prompt responses - gives me a lot of confidence in your product/service!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aneff-official picture aneff-official  路  4Comments

mtlc1402 picture mtlc1402  路  5Comments

rengert picture rengert  路  3Comments

SamBray picture SamBray  路  3Comments

w0ns88 picture w0ns88  路  6Comments