Loading htdocs/create.php +2 −5 Original line number Diff line number Diff line Loading @@ -13,8 +13,7 @@ require_once('accounts/wp_account_creator.php'); $domain = getenv("DOMAIN"); $mail_domain = getMailDomain(); $newUserListFile = getenv('NEW_USER_LIST_FILE_PATH'); $newUserMapFile = getenv('NEW_USER_LIST_MAP_PATH'); $newUserMapFile = getenv('NEW_USER_MAP_FILEPATH'); if (!isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['displayname']) || !isset($_POST['repassword'])) { $error_string = $strings["error_mandatory_missing"]; Loading Loading @@ -334,8 +333,6 @@ function has_invalid_password_characters(string $password): bool function addUserToList(string $email) { global $newUserListFile; global $newUserMapFile; file_put_contents($newUserMapFile, time() . ',' . $email.PHP_EOL , FILE_APPEND | LOCK_EX); file_put_contents($newUserListFile, $email.PHP_EOL , FILE_APPEND | LOCK_EX); file_put_contents($newUserMapFile, $email.PHP_EOL , FILE_APPEND | LOCK_EX); } private/remove_users_from_rspamd_list.pydeleted 100644 → 0 +0 −44 Original line number Diff line number Diff line import os import time map_file = open(os.getenv('NEW_USER_LIST_MAP_PATH'), 'r') txt_file = open(os.getenv('NEW_USER_LIST_FILE_PATH'), 'r') txt_file_read = txt_file.readlines() map_file_read = map_file.readlines() map_file_write = map_file_read.copy() txt_file_write = txt_file_read.copy() map_file.close() txt_file.close() hold_time = float(os.getenv('NUMBER_OF_DAYS_TO_HOLD', 10)) * 86400 current_time = time.time() for user in map_file_read: map_user = user.strip() for entry in txt_file_read: if map_user not in entry: continue created, txt_user = entry.split(',') txt_user = txt_user.strip() diff = current_time - float(created) if map_user == txt_user: print(f'user : {txt_user} - {diff/3600} hours') if (diff >= hold_time): print(f'remove user {txt_user}') map_file_write.remove(user) txt_file_write.remove(entry) if map_file_write != map_file_read: map_file = open(os.getenv('NEW_USER_LIST_MAP_PATH'), 'w') map_file.writelines(map_file_write) map_file.close() if txt_file_write != txt_file_read: txt_file = open(os.getenv('NEW_USER_LIST_FILE_PATH'), 'w') txt_file.writelines(txt_file_write) txt_file.close() No newline at end of file Loading
htdocs/create.php +2 −5 Original line number Diff line number Diff line Loading @@ -13,8 +13,7 @@ require_once('accounts/wp_account_creator.php'); $domain = getenv("DOMAIN"); $mail_domain = getMailDomain(); $newUserListFile = getenv('NEW_USER_LIST_FILE_PATH'); $newUserMapFile = getenv('NEW_USER_LIST_MAP_PATH'); $newUserMapFile = getenv('NEW_USER_MAP_FILEPATH'); if (!isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['displayname']) || !isset($_POST['repassword'])) { $error_string = $strings["error_mandatory_missing"]; Loading Loading @@ -334,8 +333,6 @@ function has_invalid_password_characters(string $password): bool function addUserToList(string $email) { global $newUserListFile; global $newUserMapFile; file_put_contents($newUserMapFile, time() . ',' . $email.PHP_EOL , FILE_APPEND | LOCK_EX); file_put_contents($newUserListFile, $email.PHP_EOL , FILE_APPEND | LOCK_EX); file_put_contents($newUserMapFile, $email.PHP_EOL , FILE_APPEND | LOCK_EX); }
private/remove_users_from_rspamd_list.pydeleted 100644 → 0 +0 −44 Original line number Diff line number Diff line import os import time map_file = open(os.getenv('NEW_USER_LIST_MAP_PATH'), 'r') txt_file = open(os.getenv('NEW_USER_LIST_FILE_PATH'), 'r') txt_file_read = txt_file.readlines() map_file_read = map_file.readlines() map_file_write = map_file_read.copy() txt_file_write = txt_file_read.copy() map_file.close() txt_file.close() hold_time = float(os.getenv('NUMBER_OF_DAYS_TO_HOLD', 10)) * 86400 current_time = time.time() for user in map_file_read: map_user = user.strip() for entry in txt_file_read: if map_user not in entry: continue created, txt_user = entry.split(',') txt_user = txt_user.strip() diff = current_time - float(created) if map_user == txt_user: print(f'user : {txt_user} - {diff/3600} hours') if (diff >= hold_time): print(f'remove user {txt_user}') map_file_write.remove(user) txt_file_write.remove(entry) if map_file_write != map_file_read: map_file = open(os.getenv('NEW_USER_LIST_MAP_PATH'), 'w') map_file.writelines(map_file_write) map_file.close() if txt_file_write != txt_file_read: txt_file = open(os.getenv('NEW_USER_LIST_FILE_PATH'), 'w') txt_file.writelines(txt_file_write) txt_file.close() No newline at end of file