Hooks that are fired on the server side are only available for use for plugins in their server side code. Same for client side hooks they are only available for use in the client side code of plugins.
Hook on a custom page
-
The first part is ok, in my plugin.json I use :
{ "hook": "filter:MyTemplate.build", "method": "myMethod" }
So the plugin is called.
How could I get the current URL from there pls ?
I see another problem, the page load loops and seems to be stuck after my plugin code was successfully executed. Is there anything to do to let the main process continue ? -
@dinendal Sure. It would be an unusual method of logging in, but there's nothing stopping your plugin from calling the login controller with the request object.
https://github.com/NodeBB/NodeBB/blob/master/src/controllers/authentication.js#L302
-
Another question again.
I'm trying to override the login with this skeleton : https://gist.github.com/julianlam/19deafaa4dbd624ceecdIt works fine but how could I intercept, in my plugin, the email and password from inputs of the login page ?
-
@yariplus said in Hook on a custom page:
@dinendal Sure. It would be an unusual method of logging in, but there's nothing stopping your plugin from calling the login controller with the request object.
https://github.com/NodeBB/NodeBB/blob/master/src/controllers/authentication.js#L302
I use
authenticationController.doLogin
I have an error popup from Nodebb :
Session interrompue Il semble que votre session ne soit plus active, ou que le serveur ne la reconnaisse plus. Merci de rafraîchir cette page.
and when I click on OK, i'm correctly log in.
What am I doing wrong ? Is there another thing to do to be log in properly ? -
translation of the error : "It looks like your login session is no longer active, or no longer recognized by your server..."
Is there a step that i'm missing ? Because when I click on "OK", I'm logged in...
"authenticationController.doLogin" is not sufficient ?
-
I don't think so, probably something to do with cookies changing. I'm guessing you need to call redirect or status.send to avoid the error.
https://github.com/NodeBB/NodeBB/blob/master/src/controllers/authentication.js#L292-L296