mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Moved unflatten to site.js, implemented Admin.cshtml view
This commit is contained in:
@@ -239,4 +239,30 @@ function validatePassword(password) {
|
||||
const strongPasswordRegex =
|
||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_\-+=\[{\]};:'",<.>/?\\|`~]).{8,}$/;
|
||||
return strongPasswordRegex.test(password);
|
||||
}
|
||||
}
|
||||
|
||||
function unflatten(obj) {
|
||||
const result = {};
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
const parts = key.split(".");
|
||||
let current = result;
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const part = parts[i];
|
||||
if (i === parts.length - 1) {
|
||||
if (typeof value === "string" && /^[\[{]/.test(value.trim())) {
|
||||
try {
|
||||
current[part] = JSON.parse(value);
|
||||
} catch {
|
||||
current[part] = value;
|
||||
}
|
||||
} else {
|
||||
current[part] = value;
|
||||
}
|
||||
} else {
|
||||
current[part] = current[part] || {};
|
||||
current = current[part];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user