Tried to add some mutli-tenant login logic to the login operation through the
beforeLoginhook, but I noticed that the hook isn't called in the login operation code, but
beforeOperationare. Perhaps the
beforeLoginis deprecated?
A
beforeLoginhook would be useful in my case though, as I want to prevent the login under certain conditions. It is to late to do so in the
afterLoginhook, and the
beforeOperationhook doesn't give me the user document.
ahhh interesting
i think we ended up removing beforeLogin as it was in the same position as the beforeOperation hook. What would you need to modify in this new hook? User? Token? Cookie?
I have a PR incoming 🙂 although, I realized I might simply be able to throw an error in the
afterLoginhook to reject a login operation.
Doing some more testing
Simply throwing did the trick.
I updated the docs and types in a PR though:
Token is set before the
afterLoginhook is called, so I'll create a PR where I bring back the
beforeLoginagain.. 🙂
@364124941832159242
we will review this today!
Thanks! 🙂
Star
Discord
online
Get dedicated engineering support directly from the Payload team.