Add 'change password' to account manager features.
This commit is contained in:
parent
14cc77bfed
commit
7cd9e58b4c
|
@ -184,7 +184,11 @@ $validate_email = 1;
|
|||
$setcookies = true;
|
||||
$anonym_address = "AnonUser@retrobbs.rocksolidbbs.com";
|
||||
$msgid_generate = "md5";
|
||||
$msgid_fqdn = $_SERVER["HTTP_HOST"];
|
||||
if (isset($_SERVER["HTTP_HOST"])) {
|
||||
$msgid_fqdn = $_SERVER["HTTP_HOST"];
|
||||
} else {
|
||||
$msgid_fqdn = false;
|
||||
}
|
||||
$post_autoquote = false;
|
||||
$post_captcha = false;
|
||||
|
||||
|
@ -246,7 +250,9 @@ if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {
|
|||
$sitelink = "http";
|
||||
}
|
||||
$sitelink .= "://";
|
||||
$sitelink .= $_SERVER['HTTP_HOST'];
|
||||
if (isset($_SERVER["HTTP_HOST"])) {
|
||||
$sitelink .= $_SERVER["HTTP_HOST"];
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not edit anything below this line
|
||||
|
|
|
@ -24,13 +24,24 @@ if ($argv[1][0] == '-') {
|
|||
break;
|
||||
case "-create":
|
||||
if (! isset($argv[2]) || ! isset($argv[3]) || ! isset($argv[4])) {
|
||||
echo "Usage: -create username password email'\n";
|
||||
echo "Usage: -create username password email\n";
|
||||
exit();
|
||||
}
|
||||
echo "Creating User: " . $argv[2] . "\n";
|
||||
create_new($argv[2], $argv[3], $argv[4]);
|
||||
break;
|
||||
case "-newpass":
|
||||
if (! isset($argv[2]) || ! isset($argv[3])) {
|
||||
echo "Usage: -newpass username password\n";
|
||||
exit();
|
||||
}
|
||||
change_user_password($argv[2], $argv[3]);
|
||||
break;
|
||||
case "-delete":
|
||||
if (! isset($argv[2])) {
|
||||
echo "Usage: -delete username\n";
|
||||
exit();
|
||||
}
|
||||
echo "Removing User: " . $argv[2] . "\n";
|
||||
$deleted_users = $config_dir . '/users/deleted/';
|
||||
$deleted_config = $config_dir . '/userconfig/deleted/';
|
||||
|
@ -56,6 +67,7 @@ if ($argv[1][0] == '-') {
|
|||
echo "-help: This help page\n";
|
||||
echo "-version: Display version\n";
|
||||
echo "-create: Create user account '-create username password email'\n";
|
||||
echo "-newpass: Change user password '-newpass username newpassword'\n";
|
||||
echo "-delete: Delete user account '-delete username'\n";
|
||||
echo " Be careful with this. You will not be asked to confirm\n";
|
||||
echo " Account files will be placed in a dir named 'deleted'\n";
|
||||
|
@ -66,6 +78,20 @@ if ($argv[1][0] == '-') {
|
|||
exit();
|
||||
}
|
||||
|
||||
function change_user_password($username, $password) {
|
||||
global $config_dir;
|
||||
$username = strtolower($username);
|
||||
$userfile = $config_dir . '/users/' . $username;
|
||||
if(! file_exists($userfile)) {
|
||||
echo "User:" . $username . " Not Found\r\n";
|
||||
return;
|
||||
} else {
|
||||
file_put_contents($userfile, password_hash($password, PASSWORD_DEFAULT));
|
||||
echo "Password changed for: " . $username . "\n";
|
||||
echo "Password: " . $password . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
function create_new($username, $password, $user_email)
|
||||
{
|
||||
global $config_dir;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* To import a group db3 file:
|
||||
* Place the article database file group.name-articles.db3 in
|
||||
* your spool directory, and change user/group to your web user.
|
||||
* Run this script as your web user from your $webdir/spoolnews dir:
|
||||
* Run this script as your web user:
|
||||
* php $config_dir/scripts/maintenance -import group.name
|
||||
*
|
||||
* This will create the overview files necessary to import the group
|
||||
|
|
Loading…
Reference in New Issue