Trying to use the "action:connected" hook
-
Sorry, another question.
Once the data hits the server I want to be able to call login. Logging into the forums needs to be invisible to the user and is tied into our existing login system. Is this a possibility? What function do I need to call on the server to begin the login process, with the data sent via the socket.
-
Sounds to me like you're better off doing a post request? Like: https://github.com/NodeBB/NodeBB/blob/master/public/src/client/login.js
-
Rather than send the required data via socket?
-
If you want to use sockets, then tap into this function:
NodeBB/src/routes/authentication.js at master · NodeBB/NodeBB
Node.js based forum software built for the modern web - NodeBB/src/routes/authentication.js at master · NodeBB/NodeBB
GitHub (github.com)
For the
req
object, pass inip
as a parameter. This is so NodeBB can log attempts. It would probably look something similar to this:SocketPlugins.myplugin.login = function(socket, data, callback) { auth.login({ip: socket.request.socket.remoteAddress}, data.username, data.password, callback); });
-
Seems to ignore the login override I have in place. Perhaps POST is better. To use POST I need CSRF included but no combination of require, define, etc with ['csrf'] as an argument is loading csrf.
require(['csrf'], function(csrf) { console.log(csrf); }
If anyone has a better suggestion I'm all ears. Looking for deep integration into our site/system without needing to login multiple times. Login will happen on our accounts page/main site. If someone visits the forums I want to grab their info (id/authkey) stored in a cookie and pass it onto the forums to verify their login without any user interaction. I'd like to use as much of the existing framework in nodebb as possible and simply plugin to our existing API to verify the info. I've managed to do the last part no problem using action:auth.overrideLogin.
-
require(['csrf'], function(csrf) { console.log(csrf.get()); });
This works for me, the code you pasted above is missing the ending
);
-
Thanks @psychobunny!
-
Yeah np, hope you manage to figure it out. Will post your site on our social network after its all done. Is your designer doing a custom theme and stuff for Quasar?
-
Likely going to take an existing one and modify it for now. Hitting Greenlight on Thursday with a show in Mississauga this weekend.
-
That's in my area, PM me details maybe I'll come swing by