Is there a command line utility that would allow changing a users password, alias, realname, etc, similar to makeuser?
Is there a command line utility that would allow changing a users password, alias, realname, etc, similar to makeuser?
On 10-18-18 14:35, echicken wrote to Mortifis <=-
@TZ: 40f0
Re: User Edit
By: Mortifis to All on Thu Oct 18 2018 14:45:09
Is there a command line utility that would allow changing a users password, alias, realname, etc, similar to makeuser?
Not that I'm aware of. 'uedit' lets you change all of these things without a GUI, but you can't just do it all in one shot from the
command line.
It wouldn't be very hard to create such a utility if there's a real use case for it. (I modify users so rarely that going into uedit to do so isn't much of a hardship.)
Re: User Edit
By: Mortifis to All on Thu Oct 18 2018 14:45:09
Is there a command line utility that would allow changing a users password, alias, realname, etc, similar to makeuser?
Not that I'm aware of. 'uedit' lets you change all of these things without a GUI, but you can't just do it all in one shot from the command line.
It wouldn't be very hard to create such a utility if there's a real use case for it. (I modify users so rarely that going into uedit to do so isn't much of a hardship.)
Re: User Edit
By: Mortifis to All on Thu Oct 18 2018 02:45 pm
Is there a command line utility that would allow changing a users password, alias, realname, etc, similar to makeuser?
Not that I can think of off hand, but if you take a look at exec/makeuser.js it wouldn't be hard to create a moduser.js (as an example) or modify makeuser.js to do what you want.
digital man
I think the statement "wouldn't be very hard" is relative, I mean, a programmer I am not, I am having a difficult time 'learning' js and c by
The scenaio is similar to the makeuser command questions I had before ... just to automate an interface between my php driven website with sbbs to keep some user details in sync.
Looking at makeuser.js I see var newuser = system.new_user(alias); if(password) newuser.security.password = password;
Looking at useredit.cpp I see putuserrec(&cfg,user.number,U_PASS,LEN_PASS,user.pass);
I am not sure where to look to examine the js functions list so I can figure out how to use them :P
Re: Re: User Editrelative, I mean, a
By: Mortifis to echicken on Thu Oct 18 2018 18:35:26
I think the statement "wouldn't be very hard" is
'learning' js and cprogrammer I am not, I am having a difficult time
I meant that ifby
Oh, I didn't necessarily mean that you would have to do it.
it there's a good case for such a script to exist, I orsomeone might make
it.questions I had before
The scenaio is similar to the makeuser command
driven website with... just to automate an interface between my php
one-way pushsbbs to keep some user details in sync.
Okay, I can see this being useful in some scenarios.
(I can also see some consistency problems. Are you doing a
from your website into Synchronet when a new user iscreated? Is your BBS
closed to new users? What happens if someone creates anaccount on your BBS
first and then on your website second, with the sameusername? I would try
to make this all bi-directional, or require users to signup on the web
first. Of course I would probably make this all toocomplicated because
that's what I do.)
system.new_user(alias);Looking at makeuser.js I see var newuser =
if(password) newuser.security.password = password;
Looking at useredit.cpp I see
The JS stuff is sort of a layer on top of this. I rarelyturn to the C/C++
source unless I need to figure out something undocumented.There's probably
a 'js_user.c' file kicking around that would be better tolook at ... but
there's an easier way:functions list so I can
I am not sure where to look to examine the js
documented here:figure out how to use them :P
If you do want to know, the "Synchronet JS Object Model" is
http://synchro.net/docs/jsobjs.htmlJS environment.
These are the special things that Synchronet exports to its
That page on its own isn't usually enough for newcomers togo on. You'd
want to comb through scripts in exec/ to see some realusage examples.
---
echicken
not really one that is as straight forward as new user in
makeuser. I more concerned about a change of password than
anything else
Re: Re: User Editin
By: Mortifis to echicken on Thu Oct 18 2018 22:00:20
not really one that is as straight forward as new user
thanmakeuser. I more concerned about a change of password
would probablyanything else
If that's *really* all you want, then a script like this
(untested) work:Thank you, your example explains the usage of many things I
// jsexec [filename] [alias] [password]
var usr = new User(system.matchuser(argv[0]));
if (usr.number > 0) {
usr.security.password = argv[1];
}
---
echicken
I am not sure where to look to examine the js functions list so I can figure out how to use them :P
Thank you, your example explains the usage of many things I
was looking at ... expounded the script to parse command-line
args including user permission to execute the script
Re: Re: User Edit
By: Mortifis to echicken on Thu Oct 18 2018 23:56:08
Thank you, your example explains the usage of many things I
was looking at ... expounded the script to parse command-line
args including user permission to execute the script
It would also be wise to check that the arguments are supplied and meet some minimum requirements:
load('sbbsdefs.js');
if (argv.length < 2) exit();
if (argv[1].length < 1 || argv[1].length > LEN_PASS) exit();
// rest of original script goes here
And so on.
the script seems to work, though I still have some condition checks to put in but the edituser.security.alias = newalias; doesn't seem to take affect?
Re: Re: User Edit
By: Mortifis to echicken on Thu Oct 18 2018 06:35 pm
I am not sure where to look to examine the js functions list so I can figure out how to use them :P
Start here:
http://wiki.synchro.net/custom:javascript
and here:
http://synchro.net/docs/js.html
digital man
Re: Re: User EditYa, I figured that out after I replied to you. :-P
By: Mortifis to echicken on Fri Oct 19 2018 10:23:04
the script seems to work, though I still have some condition checks to put in but the edituser.security.alias = newalias; doesn't seem to take affect?
Take another look at the JS Object Model docs to see how the User object is structured.
user.alias = 'whatever';
user.security.password = 'loldongs';
(Basically User.alias is a thing but User.security.alias isn't.)
makeuser.js just need to figure out how to pull the system password for comparison using the -V syspass commandline switch. It'll come to me after
Re: Re: User Edit
By: Mortifis to echicken on Thu Oct 18 2018 23:56:08
Thank you, your example explains the usage of many things I
was looking at ... expounded the script to parse command-line
args including user permission to execute the script
It would also be wise to check that the arguments are supplied and meet some minimum requirements:
load('sbbsdefs.js');
if (argv.length < 2) exit();
if (argv[1].length < 1 || argv[1].length > LEN_PASS) exit();
// rest of original script goes here
And so on.
I chose to do an:
while(argv.length > 0) {
var arg = argv.shift();
switch(arg[1].toUpperCase()) {
case "P": password= argv.shift(); if(system.trashcan("password", password) { error = true; } break; ... } then later if(password) edituser.security.password = password; ... assuming that security.password already tests for LEN_PASS
the script seems to work, though I still have some condition checks to put in but the edituser.security.alias = newalias; doesn't seem to take affect?
edituser.security.handle = newhandle;
Re: Re: User Edit
By: Mortifis to echicken on Thu Oct 18 2018 06:35 pm
I am not sure where to look to examine the js functions list so I can figure out how to use them :P
Start here:
http://wiki.synchro.net/custom:javascript
and here:
http://synchro.net/docs/js.html
how's this look? wget http://asmf-etrucker.com/edituser-js.zip
the only 'trouble' I am having is pulling the system password for permission to run the script (set for comparison on commandline as -V pass) ... is it bbs.system.password??
Re: Re: User Edit
By: Mortifis to echicken on Fri Oct 19 2018 13:32:41
makeuser.js just need to figure out how to pull the system password for comparison using the -V syspass commandline switch. It'll come to me after
How / when / in what context are you executing this script? I'm not sure that requiring the system password is a necessary step.
---
echicken
Re: Re: User Edit
By: Mortifis to echicken on Fri Oct 19 2018 10:23 am
edituser.security.handle = newhandle;
Same thing here: "handle" is not part of the user.security object.
digital man
mainly for email access. When a user changes their username, alais, password, email adress (which is typically in the form of sms xxx-xxx-xxxx@cell-carrier.xxx) on the eTrucker then that triggers edituser.js on the remote SBBS server. having an SBBS system password paramater check will ensure that the script is being executed by an authorized person. Tested and working correctly.
Re: Re: User Edit
By: Mortifis to Digital Man on Fri Oct 19 2018 01:27 pm
No. The system password itself is not modeled (for security reasons), butthere are 2 methods of confirming a system password entered is correct:
bbs.check_syspass() and system.check_syspass()
If you're running your script via JSexec, use the system.check_syspass() method.
digital man
Re: Re: User Edit
By: Mortifis to echicken on Fri Oct 19 2018 15:57:36
mainly for email access. When a user changes their username, alais, password, email adress (which is typically in the form of sms xxx-xxx-xxxx@cell-carrier.xxx) on the eTrucker then that triggers edituser.js on the remote SBBS server. having an SBBS system password paramater check will ensure that the script is being executed by an authorized person. Tested and working correctly.
One concern I'd have with this is that you have one password and many users. If every authorized person needs to know the syspass in order to make a successful request, you'd need to change your syspass if you ever deauthorize someone. (Maybe that's not a problem.)
I would lean toward giving each remote system an API key / password to use for this purpose which you can revoke without affecting everyone else. Validate the request in your PHP application before it even gets to SBBS/jsexec.
Or make them supply their current password before they change it to a new one, or alter any other details.
---
echicken
Without getting into the inner workers of the portal, no one has access to the SBBS password as there are already user levels and keys in place ... I'm not new to programming, just javascript and especially SBBS's use there of, but I do appreciate the concern :)
| Sysop: | Winzlo |
|---|---|
| Location: | Minnesota, USA |
| Users: | 11 |
| Nodes: | 16 (0 / 16) |
| Uptime: | 495949:48:05 |
| Calls: | 82 |
| Files: | 1,070 |
| Messages: | 287,256 |