Files
metabuilder/qml/MetaBuilder/ProfileDBAL.js
johndoe6345789 6e394d7846 style(qt6): 80-char margin enforced — 737 violations → 29 remaining
191 files reformatted across views, components, widgets, hybrid, contexts.
New components: CCreateSchemaDialog, CAddFieldDialog, CAdminContentPanel.
JS helpers: connBadgeStatus/Text, adminStats, exampleLabels, onLevelClicked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 15:48:39 +00:00

37 lines
1013 B
JavaScript

.pragma library
// DBAL persistence helpers for profile view.
function loadProfile(dbal, currentUser, callback) {
if (!currentUser) return
dbal.read("user", currentUser, function(result, error) {
if (result) callback(result)
})
}
function saveProfile(dbal, currentUser, data, callback) {
dbal.update("user", currentUser, data, function(result, error) {
callback(!!result, error)
})
}
function changePassword(dbal, currentUser, passwords, callback) {
if (passwords["new"] !== passwords["confirm"]) return
dbal.execute("core/change-password", {
userId: currentUser,
oldPassword: passwords["current"],
newPassword: passwords["new"]
}, function(result, error) {
callback(!!result, error)
})
}
function loadJson(relativePath) {
var xhr = new XMLHttpRequest()
xhr.open("GET", relativePath, false)
xhr.send()
if (xhr.status === 200 ||
xhr.status === 0) return JSON.parse(xhr.responseText)
return null
}