form/admin: don't allow "+" in username/email
Jellyfin doesn't like this.
This commit is contained in:
+19
@@ -176,13 +176,32 @@ const rePasswordField = document.getElementById("create-reenter-password") as HT
|
||||
|
||||
let captcha = new Captcha(window.code, window.captcha, window.reCAPTCHA, false);
|
||||
|
||||
const clearSubmitButton = () => {
|
||||
submitInput.setCustomValidity("");
|
||||
submitSpan.title = "";
|
||||
};
|
||||
|
||||
const invalidMessage = (el: HTMLInputElement, msg: string) => {
|
||||
el.setCustomValidity(msg);
|
||||
submitInput.setCustomValidity(msg);
|
||||
submitSpan.title = msg;
|
||||
};
|
||||
|
||||
function _baseValidator(oncomplete: (valid: boolean) => void, captchaValid: boolean): void {
|
||||
clearSubmitButton();
|
||||
if (window.emailRequired) {
|
||||
if (!emailField.value.includes("@")) {
|
||||
oncomplete(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
usernameField.setCustomValidity("");
|
||||
// Jellyfin doesn't like having "+" in the username field
|
||||
if (usernameField.value.includes("+")) {
|
||||
invalidMessage(usernameField, window.messages["errorSpecialSymbols"]);
|
||||
oncomplete(false);
|
||||
return;
|
||||
}
|
||||
if (window.discordEnabled && window.discordRequired && !discordVerified) {
|
||||
oncomplete(false);
|
||||
return;
|
||||
|
||||
@@ -1138,7 +1138,12 @@ export class accountsList {
|
||||
console.log("User created, but welcome email failed");
|
||||
}
|
||||
} else {
|
||||
window.notifications.customError("addUser", window.lang.var("notifications", "errorUserCreated", `"${send['username']}"`));
|
||||
let msg = window.lang.var("notifications", "errorUserCreated", `"${send['username']}"`);
|
||||
if ("error" in req.response) {
|
||||
let realError = window.lang.notif(req.response["error"]);
|
||||
if (realError) msg = realError;
|
||||
}
|
||||
window.notifications.customError("addUser", msg);
|
||||
}
|
||||
if (req.response["error"] as String) {
|
||||
console.log(req.response["error"]);
|
||||
|
||||
Reference in New Issue
Block a user