• New user script

    From Nightfox@VERT/DIGDIST to All on Wednesday, September 03, 2014 20:37:09
    Recently I have been working on a custom new user application script in JavaScript. I'm to a point where it asks the relevant questions, and now I want it to actually create the user account. It seems there might be two ways of doing this:
    1. Set the appropriate fields in the user object which exists in memory
    2. Create a new user object with all the information provided by the logged-in user

    It seems that both of these methods have their own issues. I'd like to let the new user continue and log on to the BBS, as in the default new user process, but during my testing, the BBS disconnects when I'm done creating a new user for some reason. Also, I'd like to show the user config at the end (using bbs.user_config()) so that the user can finalize their settings before continuing, but using method #1, it doesn't seem to be saving their information - It says they're user #0 and doesn't output their handle, and it also says their terminal type is TTY (instead of ANSI/ASCII).

    I've seen a new user application script (written by Merlin/Tracker1 of The Roughnecks BBS), but it takes the route of creating a new user object and emailing the password to the user and then disconnecting. I'd rather not have to disconnect the user after they create a new user account.

    Has anyone written their own custom new user script and found a way around this?

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Wednesday, September 03, 2014 21:45:35
    Re: New user script
    By: Nightfox to All on Wed Sep 03 2014 08:37 pm

    Recently I have been working on a custom new user application script in JavaScript. I'm to a point where it asks the relevant questions, and now I want it to actually create the user account. It seems there might be two ways of doing this:
    1. Set the appropriate fields in the user object which exists in memory
    2. Create a new user object with all the information provided by the logged-in user

    It seems that both of these methods have their own issues. I'd like to let the new user continue and log on to the BBS, as in the default new user process, but during my testing, the BBS disconnects when I'm done creating
    a new user for some reason. Also, I'd like to show the user config at the end (using bbs.user_config()) so that the user can finalize their settings before continuing, but using method #1, it doesn't seem to be saving their information - It says they're user #0 and doesn't output their handle, and it also says their terminal type is TTY (instead of ANSI/ASCII).

    I've seen a new user application script (written by Merlin/Tracker1 of The Roughnecks BBS), but it takes the route of creating a new user object and emailing the password to the user and then disconnecting. I'd rather not have to disconnect the user after they create a new user account.

    Has anyone written their own custom new user script and found a way around this?

    Method #1 would definitely be wrong and lead to all kinds of problems, if it even worked at all. The 'user' object should have (in hindsight) been called 'currentuser' or 'useron' or something more indicative that it represents the authenticated/authorized user and no other user instance.

    Now, I haven't tried to do exactly what you're doing (bypass all the built-in new-user creation logic in Synchronet), so I'm not sure off the top of my head that what you want to do is completely doable without modifying the C/C++ source code.

    You should use the system.new_user() method to create a new user account programmatically (as shown in the exec/makeguest.js script). You could then (in
    theory) "set" the user object to point to the newly created instance like this:

    newuser = system.new_user("user name");
    user.number = newuser.number;

    ... at least I think that should work. The normal built-in new user process does all kinds of other stuff too, some of which may not be immediatley obvious, so caveat emptor.

    digital man

    Synchronet "Real Fact" #0:
    Development began in 1990 of the (unnamed at the time) Synchronet BBS software. Norco, CA WX: 68.6øF, 81.0% humidity, 3 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From Nightfox@VERT/DIGDIST to Digital Man on Thursday, September 04, 2014 07:59:13
    Re: New user script
    By: Digital Man to Nightfox on Wed Sep 03 2014 21:45:35

    1. Set the appropriate fields in the user object which exists in
    memory
    2. Create a new user object with all the information provided
    by the logged-in user

    Method #1 would definitely be wrong and lead to all kinds of problems,
    if it even worked at all. The 'user' object should have (in hindsight) been called 'currentuser' or 'useron' or something more indicative that
    it represents the authenticated/authorized user and no other user instance.

    Now, I haven't tried to do exactly what you're doing (bypass all the built-in new-user creation logic in Synchronet), so I'm not sure off the top of my head that what you want to do is completely doable without modifying the C/C++ source code.

    newuser = system.new_user("user name");
    user.number = newuser.number;

    ... at least I think that should work. The normal built-in new user
    process does all kinds of other stuff too, some of which may not be
    immediatley obvious, so caveat emptor.

    Thanks. If the built-in new user process does a lot more than can be done in JavaScript, maybe I'll leave the built-in process in place.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com