Add configuration option to enable list of accounts - defaults to hidden

This commit is contained in:
greyhatsec-au 2022-10-08 15:32:49 +11:00
parent 1bf2920a50
commit 0fb9b4a7c0
4 changed files with 22 additions and 1 deletions

View file

@ -28,6 +28,11 @@ else
echo "DOMAINS=localhost" >> /var/www/opentrashmail/config.ini
fi
if [ "$SHOW_ACCOUNT_LIST" != "" ]; then
echo "SHOW_ACCOUNT_LIST=$SHOW_ACCOUNT_LIST" >> /var/www/opentrashmail/config.ini
echo " [i] Set show account list to: $SHOW_ACCOUNT_LIST"
fi
if [ "$ADMIN" != "" ]; then
echo "ADMIN=$ADMIN" >> /var/www/opentrashmail/config.ini
echo " [i] Set admin to: $ADMIN"

View file

@ -5,6 +5,9 @@
; pro tip: Use a wildcard domain like *.yourdomain.com to auto-generate the subdomains (you'll need to add a wildcard dns record too)
DOMAINS=yourdomain,sub.yourdomain,*.mydom.com
; Enable to show a list of all existing accounts with mail
;SHOW_ACCOUNT_LIST=true
; Enter the admin email address. If you choose this email on the website you will see all emails from all users
; The email doesn't really have to exist or have mail but must look like an email address
;ADMIN=some@random.email

View file

@ -141,8 +141,16 @@ switch($action)
$o = array('status'=>'ok','emails'=>$data);
}
break;
case 'show-list':
$settings = loadSettings();
$o = $settings['SHOW_ACCOUNT_LIST'];
break;
case 'list-addresses':
$o = array('status'=>'ok','addresses'=>listEmailAdresses());
$settings = loadSettings();
$o = array('status'=>'ok','addresses'=>[]);
if ($settings['SHOW_ACCOUNT_LIST'])
$o['addresses'] = listEmailAdresses();
break;
}

View file

@ -16,6 +16,11 @@ $( document ).ready(function() {
domains = data;
else $("#btn-gen-random").hide();
},"json")
$.get("api.php?a=show-list",function(data){
if (!data)
$("#btn-list-addresses").hide();
},"json")
});
function loadMail(email,id)