Warning, /network/neochat/src/qml/RegisterPassword.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 
0006 import org.kde.kirigami as Kirigami
0007 import org.kde.kirigamiaddons.formcard as FormCard
0008 
0009 import org.kde.neochat
0010 
0011 LoginStep {
0012     id: root
0013 
0014     onActiveFocusChanged: if (activeFocus) passwordField.forceActiveFocus()
0015 
0016     FormCard.FormTextFieldDelegate {
0017         id: passwordField
0018         label: i18n("Password:")
0019         echoMode: TextInput.Password
0020         onTextChanged: Registration.password = text
0021         Keys.onReturnPressed: {
0022             confirmPasswordField.forceActiveFocus()
0023         }
0024     }
0025 
0026     FormCard.FormTextFieldDelegate {
0027         id: confirmPasswordField
0028         label: i18n("Confirm Password:")
0029         enabled: passwordField.enabled
0030         echoMode: TextInput.Password
0031         statusMessage: passwordField.text.length === confirmPasswordField.text.length && passwordField.text !== confirmPasswordField.text ? i18n("The passwords do not match.") : ""
0032         Keys.onReturnPressed: {
0033             if (root.nextAction.enabled) {
0034                 root.nextAction.trigger()
0035             }
0036         }
0037     }
0038 
0039     nextAction: Kirigami.Action {
0040         onTriggered: {
0041             passwordField.enabled = false
0042             Registration.registerAccount()
0043         }
0044         enabled: passwordField.text === confirmPasswordField.text
0045     }
0046 
0047     previousAction: Kirigami.Action {
0048         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
0049     }
0050 }