Wichtig
- eingesetzte Version
- V5
- Fehlerbeschreibung
- Bei Verwendung von GastAccounts Fehler
Beschreibung
Wenn man Gast-Account aktiviert hat und auf der Seite https://demoshop.commerce-seo.de/shop.php?do=CreateGuest irgend wo auf die Seite klickt, kommt Fehler:
gm_javascript.php?page=Account&v=5304:74 Uncaught TypeError: Cannot read properties of null (reading 'value')
at HTMLDocument.<anonymous> (gm_javascript.php?pa…count&v=5304:74:913)
Da werden wohl Eigenschaften gesucht und nicht gefunden. Keine Ahnung ob es eine Rolle bei der Anmeldung verursacht...
Die Lösung für AccountHandler.js
Code
document.addEventListener('DOMContentLoaded', function() {
function viewPassword() {
const createPasswordInput = document.getElementById("create_password");
const validatePasswordInput = document.getElementById("validate_password");
const showPasswordIcon = document.querySelector(".showpassword");
if (createPasswordInput) {
createPasswordInput.type = createPasswordInput.type === "password" ? "text" : "password";
}
if (validatePasswordInput) {
validatePasswordInput.type = validatePasswordInput.type === "password" ? "text" : "password";
}
if (showPasswordIcon) {
showPasswordIcon.classList.toggle("hide");
}
}
function strength(password) {
let strengthLevel = 0;
if (password.length > 6) strengthLevel++;
if (password.length >= 10) strengthLevel++;
if (/[A-Z]/.test(password)) strengthLevel++;
if (/[0-9]/.test(password)) strengthLevel++;
if (/[A-Za-z0-8]/.test(password)) strengthLevel++;
return strengthLevel;
}
const passwordInputField = document.querySelector(".create_password_input_field");
const passwordInput = document.querySelector("#create_password");
const remainingCharsDisplay = document.getElementById("verbleibende_zeichen_1");
function countChars(inputField, maxLength) {
if (inputField && remainingCharsDisplay) {
const currentLength = inputField.value.length;
const remaining = maxLength - currentLength;
remainingCharsDisplay.innerHTML = currentLength < maxLength
? `<span style="color: green;">${remaining}</span>`
: `<span style="color: red; font-weight: bold;">${currentLength}</span>`;
}
}
if (passwordInput && passwordInputField) {
passwordInput.addEventListener("keyup", function() {
const passwordStrength = strength(this.value);
passwordInputField.classList.remove("weak", "moderate", "strong");
if (passwordStrength <= 2) {
passwordInputField.classList.add("weak");
} else if (passwordStrength <= 4) {
passwordInputField.classList.add("moderate");
} else {
passwordInputField.classList.add("strong");
}
});
}
if (passwordInput) {
passwordInput.addEventListener("input", () => countChars(passwordInput, 255));
}
if (jQuery && jQuery("select#country").length) {
jQuery("select#country").change(function() {
const countryValue = jQuery(this).val();
jQuery.ajax({
type: "GET",
url: "request_port.php",
data: { module: "getCountry", needle: countryValue, cSEOid: gm_session_id },
cache: false,
async: true,
error: function() {
console.error("get_available_values: error");
},
success: function(data) {
jQuery("#state").html(data);
},
beforeSend: function() {
jQuery("#state").html('<p style="width:198px" align="center"><img src="images/wait.gif" alt="" /></p>');
}
});
});
}
});
Alles anzeigen
:
Kommentare 1