mirror of
https://github.com/PC-Admin/matrix-moderation-tool.git
synced 2024-12-19 07:00:27 -05:00
default to not erasing user data on deactivation
This commit is contained in:
parent
fee582cef0
commit
dd6d0abd15
@ -71,7 +71,13 @@ while pass_token == False:
|
|||||||
print("\nPlease enter a number from the above menu, or enter 'q' or 'e' to exit.\n")
|
print("\nPlease enter a number from the above menu, or enter 'q' or 'e' to exit.\n")
|
||||||
menu_input = input()
|
menu_input = input()
|
||||||
if menu_input == "1":
|
if menu_input == "1":
|
||||||
user_commands.deactivate_account('')
|
erase_data = input("Deactivating account. Do you want to also erase the user's data? (y/n) ")
|
||||||
|
if erase_data in ["y", "Y", "yes", "Yes", "YES"]:
|
||||||
|
user_commands.deactivate_account('',True)
|
||||||
|
elif erase_data in ["n", "N", "no", "No", "NO"]:
|
||||||
|
user_commands.deactivate_account('')
|
||||||
|
else:
|
||||||
|
print("\nIncorrect input detected, please select 'y' or 'n'!\n")
|
||||||
elif menu_input == "2":
|
elif menu_input == "2":
|
||||||
user_commands.deactivate_multiple_accounts()
|
user_commands.deactivate_multiple_accounts()
|
||||||
elif menu_input == "3":
|
elif menu_input == "3":
|
||||||
|
@ -13,8 +13,8 @@ def parse_username(username):
|
|||||||
username = username.replace(tail_end,'')
|
username = username.replace(tail_end,'')
|
||||||
return username
|
return username
|
||||||
|
|
||||||
def deactivate_account(preset_username):
|
def deactivate_account(preset_username, erase=False):
|
||||||
if len(preset_username) == 0:
|
if preset_username == '':
|
||||||
username = input("\nPlease enter the username to deactivate: ")
|
username = input("\nPlease enter the username to deactivate: ")
|
||||||
username = parse_username(username)
|
username = parse_username(username)
|
||||||
else:
|
else:
|
||||||
@ -28,7 +28,7 @@ def deactivate_account(preset_username):
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"erase": True
|
"erase": erase
|
||||||
}
|
}
|
||||||
|
|
||||||
print("\n" + url + "\n")
|
print("\n" + url + "\n")
|
||||||
@ -50,19 +50,31 @@ def deactivate_multiple_accounts():
|
|||||||
with open(user_list_location, newline='') as f:
|
with open(user_list_location, newline='') as f:
|
||||||
reader = csv.reader(f)
|
reader = csv.reader(f)
|
||||||
data = list(reader)
|
data = list(reader)
|
||||||
|
print(data)
|
||||||
delete_confirmation = input("\n" + str(data) + "\n\nAre you sure you want to deactivate these users? y/n?\n")
|
delete_confirmation = input("\n" + str(data) + "\n\nAre you sure you want to deactivate these users? y/n?\n")
|
||||||
|
erase_confirmation = input("\nDo you want to also erase all these users' data? y/n?\n")
|
||||||
|
if erase_confirmation in ["y", "Y", "yes", "Yes", "YES"]:
|
||||||
|
erase = True
|
||||||
|
elif erase_confirmation in ["n", "N", "no", "No", "NO"]:
|
||||||
|
erase = False
|
||||||
|
else:
|
||||||
|
print("\nIncorrect input detected, please select 'y' or 'n'!\n")
|
||||||
|
return
|
||||||
#print(len(data[0]))
|
#print(len(data[0]))
|
||||||
#print(data[0][0])
|
#print(data[0][0])
|
||||||
if delete_confirmation == "y" or delete_confirmation == "Y" or delete_confirmation == "yes" or delete_confirmation == "Yes":
|
if delete_confirmation ["y", "Y", "yes", "Yes", "YES"]:
|
||||||
x = 0
|
x = 0
|
||||||
while x <= (len(data) - 1):
|
while x <= (len(data) - 1):
|
||||||
#print(data[0][x])
|
#print(data[0][x])
|
||||||
deactivate_account(data[x][0])
|
status = deactivate_account(data[x][0], erase)
|
||||||
|
#print(status)
|
||||||
x += 1
|
x += 1
|
||||||
#print(x)
|
#print(x)
|
||||||
time.sleep(10)
|
time.sleep(5)
|
||||||
if delete_confirmation == "n" or delete_confirmation == "N" or delete_confirmation == "no" or delete_confirmation == "No":
|
elif delete_confirmation in ["n", "N", "no", "No", "NO"]:
|
||||||
print("\nExiting...\n")
|
print("\nExiting...\n")
|
||||||
|
else:
|
||||||
|
print("\nIncorrect input detected, please select 'y' or 'n'!\n")
|
||||||
|
|
||||||
def create_account(preset_username, preset_password):
|
def create_account(preset_username, preset_password):
|
||||||
if len(preset_username) == 0 and len(preset_password) == 0:
|
if len(preset_username) == 0 and len(preset_password) == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user