status-desktop/ui/shared/keycard/PINModal.qml

70 lines
1.8 KiB
QML
Raw Normal View History

2021-09-24 12:03:57 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import StatusQ.Controls 0.1
import "../../imports"
import "../../shared"
ModalPopup {
property bool pinFieldValid: false
2021-10-01 10:22:51 +00:00
property bool submitted: false
2021-09-24 12:03:57 +00:00
id: popup
title: qsTr("Authenticate PIN")
height: 400
onOpened: {
2021-10-01 10:22:51 +00:00
submitted = false
2021-09-24 12:03:57 +00:00
pinField.text = "";
pinField.forceActiveFocus(Qt.MouseFocusReason)
}
Input {
id: pinField
anchors.rightMargin: 56
anchors.leftMargin: 56
anchors.top: parent.top
anchors.topMargin: 88
placeholderText: qsTr("PIN")
textField.echoMode: TextInput.Password
onTextChanged: {
[pinFieldValid, _] =
Utils.validatePINs("first", pinField, pinField);
}
}
StyledText {
text: qsTr("Insert your 6-digit PIN")
wrapMode: Text.WordWrap
anchors.right: parent.right
anchors.rightMargin: Style.current.xlPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.xlPadding
horizontalAlignment: Text.AlignHCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
color: Style.current.secondaryText
font.pixelSize: 12
}
footer: Item {
width: parent.width
height: submitBtn.height
StatusButton {
id: submitBtn
anchors.bottom: parent.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
text: qsTr("Authenticate")
enabled: pinFieldValid
onClicked: {
2021-10-01 10:22:51 +00:00
submitted = true
keycardModel.authenticate(pinField.text)
popup.close()
2021-09-24 12:03:57 +00:00
}
}
}
}