options.UseIdentity<IdentityMySQLDb>(db =>
db.UseMySql(_config.GetConnectionString("piranha")),
identityOptions: o => {
o.User.RequireUniqueEmail = true;
o.Tokens.PasswordResetTokenProvider = TokenOptions.DefaultProvider;
o.Tokens.EmailConfirmationTokenProvider = TokenOptions.DefaultProvider;
},
Register
for pages, only RegisterOnLoad
, RegisterOnBeforeSave
and so on:App.Hooks.Pages.RegisterOnBeforeSave((p) => {
p.Title = "I changed the title!!!";
});
@tidyui Yes, I was just sloppy writing. I know there's 5 hooks for each Model that has hooks - part from those that have a sixth that is validation.
Reason I ask is that I can't get all hooks to fire as I would expect them to - and I suspect it's just me missing something rather obvious (or not so obvious maybe).
For Comments it's easy and I have had no issues what so ever to use them - similar to the example above.
Pages and Posts however... not so much. I believe there's something with the Posts and Pages being derived. A note on the documentation pages hints about casting but that does not make sense either since the hooks have a signature of the delegate.
When I write this now I realize something. I did NOT test Before/After save from the Manager. I only tried it using the seed functionality. Still, that code also save posts and pages.
Reason I asked was the fix of GenericContent hooks. The code in core calls the hooks but the HookManager lack the exposed Hook property. That's what I initially thought was the thing missing. And maybe it still is, but when I did not get the hooks to fire as I expected I reverted back to trying the Page/Post hooks for reference - and got in trouble there too.
@jensbrak Regarding your hooks not being called, the only thing I can think of is that since the methods internally are stored in a generic collection, they must be registered and called with the same type, i.e Comment. If PageComment or PostComment is passed in somewhere as type identifier there will be a mismatch.
https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha/Services/PageService.cs#L667
@jensbrak I have done a little digging with the manager login problem with the example apps in my case I have been using google chrome for my browser.
So all seems to be working from what I can see and the code is doing as it should as far as I can tell. So in an attempt to try and login I wondered what would happen if I open an incognito window and try to login, well it only went and worked and took me to the manager. So my initial thought was something is caching so I cleared all browser data and tried again out of incognito and login fails. I have then cleared browser data again and commented out this line from the startup class in the MvcWeb example
// Configure cache level
App.CacheLevel = Piranha.Cache.CacheLevel.Full;
and tried again but still the same problem and cannot login. So I opened the edge browser and tried to login and it works fine. Hopefully either you or @tidyui can help shed a little more light onto what is happening here as at the minute ive been left not knowing what to check next lol
@jensbrak @GangsterGeek89 Regarding login issues, the only thing I’ve seen in the past is issues related to running one application on the local machine and logging in to the manager, then terminating that project and starting another application on the local machine on the same url. The login will fail in this case because of the stray cookie from the other application.
We tried to resolve this by always doing a sign out before signing in.
@GangsterGeek89 - I only tried different scenarious starting the app, not downloading it again or something. It just started to run and I was actually looking at cookies as it kinda reminded of the too-large-cookie-issue I have had.
@tidyui - Ah, that's why there was a logout before login. I noticed it while stepping though things. Obviously that is not a completely working fix but I appreciate the effort and it's a logical thing to do.
I will need to have a look at those cookies at some time since I get an error if I leave my online-site manager session for too long. There's something about asp.net and the cookies. Clearly.
The problem is to try to reproduce the login issue on demand in order to find a good fix for it. And as mentioned, I see nothing that is Piranha specific to this - even though Piranha is affected and there's a sort-of-fix already in place for it. :)
@tidyui - I'm pretty much done with the changes of the comment moderation suggestion. Some tweaking and def more testing.
A question: notice you use Font Awesome for things like the trashbin in Manager. Is there any specific parts / packs from them in use? Was thinking about a suitable icon for the column that will show comments 'flagged'. Since it will be a column with an indication and not something to interact with, I was thinkin a suitable icon that is turned on or off (shown and now shown for instance).
Then we have a different scenarios regarding how to interpret att use the rejection/spam state - but maybe that's better to have in the PR and when looking at the suggestion presented.