Hook on a custom page
-
Hello there,
I'm writing a plugin to interconnect 2 systems.
I would like to know how to fire a hook from a specific custom page (i already create the page).The purpose is :
- go to URL with parameters (ex. http://myaddress/myCustomPage?id=jklDGFYHcgfu)
- automatically fire a hook that call my plugin
- parse URL to get parameters (if you could explain how to get the current url in the plugin too, pls)
- do some stuff etc.
Could you please help me ?
Philippe.
-
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.
NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
Node.js based forum software built for the modern web - NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
GitHub (github.com)
-
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.
NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
Node.js based forum software built for the modern web - NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
GitHub (github.com)
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.
NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
Node.js based forum software built for the modern web - NodeBB/src/controllers/authentication.js at master · NodeBB/NodeBB
GitHub (github.com)