"Auto-registering" users with data from other database



  • Hello everyone,

    I basically have a website and want to implement a forum in it. I already have many users registered (100+) and I didn't want to ask them to register all over again in NodeBB's forum. So I basically want to grab all their information (email, username and encrypted password) and "auto-register" them so that they can just go there and log with their emails as normal. I could even just set a default password and tell them to change it when they first login. All I really want is to avoid asking them to go through the registration process again.

    I'm currenly using MongoDB and I've tried inserting the documents somewhat "manually" in the "objects" collection but NodeBB wouldn't increment the number of registered users. I updated every single document (key/value) I found to be modified when a user registers, but with no success.

    I also tried removing the CSRF requirement and simply simulated multiple POSTs with the username/password/email querystring, but I kept receiving an error. I used DHC (Chrome's app) and received 302 status codes, which are fine.


    Error:

    TypeError: Cannot call method 'trim' of undefined
        at Object.User.create (NodeBB\src\user\create.js:21:30)
        at Object.<anonymous> (NodeBB\src\routes\authentication.js:121:9)
        at Object.Plugins.fireHook (NodeBB\src\plugins.js:502:14)
        at register (NodeBB\src\routes\authentication.js:116:11)
        at Layer.handle [as handle_request] (NodeBB\node_modules\express\lib\router\layer.js:82:5)
        at next (NodeBB\node_modules\express\lib\router\route.js:100:13)
        at NodeBB\node_modules\connect-ensure-login\lib\ensureLoggedOut.js:41:5
        at Layer.handle [as handle_request] (NodeBB\node_modules\express\lib\router\layer.js:82:5)
        at next (NodeBB\node_modules\express\lib\router\route.js:100:13)
        at Route.dispatch (NodeBB\node_modules\express\lib\router\route.js:81:3)
    

    The problem happens in this piece of code and it's caused by an empty JSON in "data":

    User.create = function(data, callback) {
    	var gravatar = User.createGravatarURLFromEmail(data.email);
    	var timestamp = Date.now();
    	var password = data.password;
    
    	var userData = {
    		'username': data.username.trim(),
    		'email': data.email,
    

    Anyways, that's basically it... I've pretty much attempted many things, but just couldn't get this to work. Has anyone ever achieved successfully what I just described?

    Regards!


  • Admin

    Auto-registering is difficult, is maintaining an SSO endpoint on your end not feasible?


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.