add account deletion
This commit is contained in:
parent
1a59dfbd34
commit
739ee81002
5 changed files with 46 additions and 8 deletions
|
@ -1699,6 +1699,37 @@ class Localuser {
|
|||
devPortal.addHTMLArea(appListContainer);
|
||||
});
|
||||
}
|
||||
{
|
||||
const deleteAccount = settings.addButton(I18n.localuser.deleteAccount()).addForm(
|
||||
"",
|
||||
() => {
|
||||
this.userinfo.remove();
|
||||
window.location.href = "/";
|
||||
},
|
||||
{
|
||||
headers: this.headers,
|
||||
method: "POST",
|
||||
fetchURL: this.info.api + "/users/@me/delete/",
|
||||
traditionalSubmit: false,
|
||||
submitText: I18n.localuser.deleteAccountButton(),
|
||||
},
|
||||
);
|
||||
const shrek = deleteAccount.addTextInput(
|
||||
I18n.localuser.areYouSureDelete(I18n.localuser.sillyDeleteConfirmPhrase()),
|
||||
"shrek",
|
||||
);
|
||||
deleteAccount.addTextInput(I18n.localuser["password:"](), "password");
|
||||
deleteAccount.addPreprocessor((obj) => {
|
||||
if ("shrek" in obj) {
|
||||
if (obj.shrek !== I18n.localuser.sillyDeleteConfirmPhrase()) {
|
||||
throw new FormError(shrek, I18n.localuser.mustTypePhrase());
|
||||
}
|
||||
delete obj.shrek;
|
||||
} else {
|
||||
throw new FormError(shrek, I18n.localuser.mustTypePhrase());
|
||||
}
|
||||
});
|
||||
}
|
||||
settings.show();
|
||||
}
|
||||
readonly botTokens: Map<string, string> = new Map();
|
||||
|
|
|
@ -790,7 +790,7 @@ class Options implements OptionsElement<void> {
|
|||
onSubmit: (arg1: object, sent: object) => void,
|
||||
{
|
||||
ltr = false,
|
||||
submitText = "Submit",
|
||||
submitText = I18n.getTranslation("submit"),
|
||||
fetchURL = "",
|
||||
headers = {},
|
||||
method = "POST",
|
||||
|
|
|
@ -89,6 +89,11 @@ export class Specialuser {
|
|||
console.error("There are fundamentally missing pieces of info missing from this user");
|
||||
}
|
||||
}
|
||||
remove() {
|
||||
const info = getBulkInfo();
|
||||
delete info.users[this.uid];
|
||||
localStorage.setItem("userinfos", JSON.stringify(info));
|
||||
}
|
||||
set pfpsrc(e) {
|
||||
this.json.pfpsrc = e;
|
||||
this.updateLocal();
|
||||
|
|
|
@ -316,7 +316,12 @@
|
|||
"advancedBot": "Advanced Bot Settings",
|
||||
"botInviteCreate": "Bot Invite Creator",
|
||||
"language": "Language:",
|
||||
"connections": "Connections"
|
||||
"connections": "Connections",
|
||||
"deleteAccount": "Account Deletion",
|
||||
"areYouSureDelete": "Are you sure you want to delete your account? If so enter the phrase $1",
|
||||
"sillyDeleteConfirmPhrase": "Shrek is love, Shrek is life",
|
||||
"deleteAccountButton": "Delete account",
|
||||
"mustTypePhrase": "To delete your account you must type the phrase"
|
||||
},
|
||||
"message": {
|
||||
"reactionAdd": "Add reaction",
|
||||
|
|
|
@ -3,11 +3,7 @@
|
|||
"last-updated": "2024/11/4",
|
||||
"locale": "en",
|
||||
"comment": "Don't know how often I'll update this top part lol",
|
||||
"authors": [
|
||||
"MathMan05",
|
||||
"McDutchie",
|
||||
"Vl1"
|
||||
]
|
||||
"authors": ["MathMan05", "McDutchie", "Vl1"]
|
||||
},
|
||||
"readableName": "{{doc-important|This should be the name of the language you are translating into, in that language. Please DO NOT translate this into your language’s word for “English”!}}",
|
||||
"typing": "$1 is the number of people typing and $2 is the names of the people typing separated by commas",
|
||||
|
@ -22,7 +18,8 @@
|
|||
},
|
||||
"localuser": {
|
||||
"updateSettings": "Title of a page that allows you to adjust the update settings",
|
||||
"description": "This object contains strings related to the logged in user, which is mostly the settings for the user"
|
||||
"description": "This object contains strings related to the logged in user, which is mostly the settings for the user",
|
||||
"sillyDeleteConfirmPhrase": "This is a silly phrase, do not translate this directly, make a joke that is easy to type in your language"
|
||||
},
|
||||
"errorReconnect": "Uses MarkDown"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue