diff --git a/workstation-setup/src/Main.qml b/workstation-setup/src/Main.qml index 3b42cb1..e7ddc73 100644 --- a/workstation-setup/src/Main.qml +++ b/workstation-setup/src/Main.qml @@ -14,6 +14,9 @@ Kirigami.ApplicationWindow { property int currentStep: 0 property string operationError: "" property bool closeAttempted: false + property bool passwordProcessing: false + property bool passwordJustSaved: false + property int passwordNextStep: 2 property var stepsWithYubiKey: [ { "page": 0, "title": "Bienvenue", "subtitle": "Première connexion" }, @@ -80,9 +83,15 @@ Kirigami.ApplicationWindow { } function onPasswordChangeFinished(success, message) { + root.passwordProcessing = false root.operationError = success ? "" : message - if (success) - root.currentStep = provisioning.yubiKeyRequested ? 2 : 4 + if (success) { + root.passwordNextStep = provisioning.yubiKeyRequested ? 2 : 4 + root.passwordJustSaved = true + passwordSuccessTimer.restart() + } else { + root.passwordJustSaved = false + } } function onPinChangeFinished(success, message) { @@ -118,6 +127,16 @@ Kirigami.ApplicationWindow { onTriggered: root.closeAttempted = false } + Timer { + id: passwordSuccessTimer + interval: 700 + repeat: false + onTriggered: { + root.passwordJustSaved = false + root.currentStep = root.passwordNextStep + } + } + function passwordStrengthLevel(password) { if (password.length === 0) return 0 var classes = 0 @@ -616,6 +635,8 @@ Kirigami.ApplicationWindow { enabled: root.passwordStepValid && !provisioning.busy onClicked: { root.operationError = "" + root.passwordJustSaved = false + root.passwordProcessing = true var c = currentPassword.text var n = newPassword.text var r = confirmPassword.text @@ -626,6 +647,76 @@ Kirigami.ApplicationWindow { } } } + Rectangle { + anchors.fill: parent + visible: root.passwordProcessing || root.passwordJustSaved + z: 20 + color: "#f8fafc" + + ColumnLayout { + anchors.centerIn: parent + width: Math.min(560, parent.width - 80) + spacing: 20 + + Item { + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: 92 + Layout.preferredHeight: 92 + + Controls.BusyIndicator { + anchors.fill: parent + visible: root.passwordProcessing + running: visible + } + + Rectangle { + anchors.fill: parent + visible: root.passwordJustSaved + radius: width / 2 + color: "#dcfce7" + border.width: 2 + border.color: "#86efac" + + Controls.Label { + anchors.centerIn: parent + text: "✓" + color: "#15803d" + font.pixelSize: 46 + font.weight: Font.Bold + } + + SequentialAnimation on scale { + running: root.passwordJustSaved + loops: 1 + NumberAnimation { from: 0.75; to: 1.08; duration: 180; easing.type: Easing.OutCubic } + NumberAnimation { from: 1.08; to: 1.0; duration: 160; easing.type: Easing.InOutCubic } + } + } + } + + Controls.Label { + Layout.fillWidth: true + text: root.passwordJustSaved + ? "Mot de passe enregistré" + : "Sécurisation de votre nouveau mot de passe…" + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + color: "#0f172a" + font.pixelSize: 25 + font.weight: Font.Bold + } + + Controls.Label { + Layout.fillWidth: true + visible: root.passwordProcessing + text: "Cette opération peut prendre quelques secondes." + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + color: "#64748b" + font.pixelSize: 15 + } + } + } } // 2 - PIN YubiKey diff --git a/workstation-setup/src/main.cpp b/workstation-setup/src/main.cpp index fb9031a..f91c6ae 100644 --- a/workstation-setup/src/main.cpp +++ b/workstation-setup/src/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) QGuiApplication::setOrganizationName(QStringLiteral("Raspot")); QGuiApplication::setOrganizationDomain(QStringLiteral("raspot.in")); QGuiApplication::setApplicationName(QStringLiteral("NixOS Workstations Setup")); - QGuiApplication::setApplicationVersion(QStringLiteral("1.9.1")); + QGuiApplication::setApplicationVersion(QStringLiteral("1.9.2")); QGuiApplication::setDesktopFileName(QStringLiteral("org.raspot.nixosworkstations.setup")); QCommandLineParser parser;