Invites: unique email/ID requirement

"Require unique ..." Settings (`require_unique` in relevant sections of
config.ini) are now available for email/discord/telegram/matrix. An
error is shown on the invite form if a non-unique address/ID is used.
This was on my kanban without a link to an issue, so i'm guessing it was
requested on Discord.
This commit is contained in:
Harvey Tindall
2023-02-01 15:11:10 +00:00
parent 895dcf5a30
commit 2722e8482d
8 changed files with 284 additions and 57 deletions
+10
View File
@@ -61,6 +61,9 @@ if (window.telegramEnabled) {
window.telegramModal.close();
window.notifications.customError("invalidCodeError", window.messages["errorInvalidCode"]);
return;
} else if (req.status == 400) {
window.telegramModal.close();
window.notifications.customError("accountLinkedError", window.messages["errorAccountLinked"]);
} else if (req.status == 200) {
if (req.response["success"] as boolean) {
telegramVerified = true;
@@ -124,6 +127,9 @@ if (window.discordEnabled) {
window.discordModal.close();
window.notifications.customError("invalidCodeError", window.messages["errorInvalidCode"]);
return;
} else if (req.status == 400) {
window.discordModal.close();
window.notifications.customError("accountLinkedError", window.messages["errorAccountLinked"]);
} else if (req.status == 200) {
if (req.response["success"] as boolean) {
discordVerified = true;
@@ -165,6 +171,10 @@ if (window.matrixEnabled) {
};
_post("/invite/" + window.code + "/matrix/user", send, (req: XMLHttpRequest) => {
if (req.readyState == 4) {
if (req.status == 400 && req.response["error"] == "errorAccountLinked") {
window.matrixModal.close();
window.notifications.customError("accountLinkedError", window.messages["errorAccountLinked"]);
}
removeLoader(submitButton);
userID = input.value;
if (req.status != 200) {