2024-10-15 10:45:50 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2024-03-14 18:24:38 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2023-04-02 18:49:43 +00:00
|
|
|
|
2022-10-11 13:58:34 +00:00
|
|
|
ColumnLayout {
|
2022-03-01 15:59:38 +00:00
|
|
|
id: root
|
|
|
|
|
2024-10-15 10:45:50 +00:00
|
|
|
readonly property bool ready: newPswInput.text.length >= Constants.minPasswordLength && newPswInput.text === confirmPswInput.text && errorTxt.text === ""
|
|
|
|
|
2022-03-01 15:59:38 +00:00
|
|
|
property bool createNewPsw: true
|
2024-03-14 18:24:38 +00:00
|
|
|
property string title: createNewPsw ? qsTr("Create a password") : qsTr("Change your password")
|
2022-03-01 15:59:38 +00:00
|
|
|
property bool titleVisible: true
|
2024-02-09 11:31:37 +00:00
|
|
|
property real titleSize: 22
|
2024-03-14 18:24:38 +00:00
|
|
|
property string introText: {
|
|
|
|
if (createNewPsw) {
|
|
|
|
return qsTr("Create a password to unlock Status on this device & sign transactions.")
|
|
|
|
}
|
|
|
|
|
|
|
|
return qsTr("Change password used to unlock Status on this device & sign transactions.")
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
property string recoverText: qsTr("You will not be able to recover this password if it is lost.")
|
2022-11-21 07:30:11 +00:00
|
|
|
property string strengthenText: qsTr("Minimum %n character(s). To strengthen your password consider including:", "", Constants.minPasswordLength)
|
2022-10-11 13:58:34 +00:00
|
|
|
property bool highSizeIntro: false
|
2024-02-09 11:31:37 +00:00
|
|
|
|
|
|
|
property int contentAlignment: Qt.AlignHCenter
|
2022-07-20 12:34:44 +00:00
|
|
|
|
|
|
|
property var passwordStrengthScoreFunction: function () {}
|
2022-03-22 09:29:59 +00:00
|
|
|
|
2022-03-01 15:59:38 +00:00
|
|
|
readonly property int zBehind: 1
|
|
|
|
readonly property int zFront: 100
|
|
|
|
|
|
|
|
property alias currentPswText: currentPswInput.text
|
|
|
|
property alias newPswText: newPswInput.text
|
|
|
|
property alias confirmationPswText: confirmPswInput.text
|
|
|
|
property alias errorMsgText: errorTxt.text
|
|
|
|
|
2022-05-06 12:47:46 +00:00
|
|
|
signal returnPressed()
|
|
|
|
|
2022-03-01 15:59:38 +00:00
|
|
|
function forceNewPswInputFocus() { newPswInput.forceActiveFocus(Qt.MouseFocusReason) }
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
newPswInput.text = ""
|
|
|
|
currentPswInput.text = ""
|
|
|
|
confirmPswInput.text = ""
|
|
|
|
errorTxt.text = ""
|
|
|
|
strengthInditactor.strength = StatusPasswordStrengthIndicator.Strength.None
|
|
|
|
|
|
|
|
// Update focus:
|
|
|
|
if(root.createNewPsw)
|
|
|
|
newPswInput.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
else
|
|
|
|
currentPswInput.forceActiveFocus(Qt.MouseFocusReason)
|
|
|
|
}
|
|
|
|
|
2022-05-11 08:10:31 +00:00
|
|
|
function checkPasswordMatches(onlyIfConfirmPasswordHasFocus = true) {
|
2022-10-11 13:58:34 +00:00
|
|
|
if (confirmPswInput.text.length === 0) {
|
2022-05-11 11:33:07 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-10-11 13:58:34 +00:00
|
|
|
if (onlyIfConfirmPasswordHasFocus && !confirmPswInput.focus) {
|
2022-05-11 08:10:31 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-11-21 07:30:11 +00:00
|
|
|
if(newPswInput.text.length >= Constants.minPasswordLength) {
|
2022-03-01 15:59:38 +00:00
|
|
|
if(confirmPswInput.text !== newPswInput.text) {
|
|
|
|
errorTxt.text = qsTr("Passwords don't match")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
property bool containsLower: false
|
|
|
|
property bool containsUpper: false
|
|
|
|
property bool containsNumbers: false
|
|
|
|
property bool containsSymbols: false
|
|
|
|
|
2024-10-15 10:45:50 +00:00
|
|
|
readonly property var validatorRegexp: /^[!-~]+$/
|
|
|
|
readonly property string validatorErrMessage: qsTr("Only ASCII letters, numbers, and symbols are allowed")
|
|
|
|
readonly property string passTooLongErrMessage: qsTr("Maximum %n character(s)", "", Constants.maxPasswordLength)
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
// Password strength categorization / validation
|
|
|
|
function lowerCaseValidator(text) { return (/[a-z]/.test(text)) }
|
|
|
|
function upperCaseValidator(text) { return (/[A-Z]/.test(text)) }
|
|
|
|
function numbersValidator(text) { return (/\d/.test(text)) }
|
2024-10-15 10:45:50 +00:00
|
|
|
// That includes NOT extended ASCII printable symbols less space:
|
2022-03-01 15:59:38 +00:00
|
|
|
function symbolsValidator(text) { return (/[!-\/:-@[-`{-~]/.test(text)) }
|
|
|
|
|
2023-06-26 10:56:08 +00:00
|
|
|
function validateCharacterSet(text) {
|
|
|
|
if(!(d.validatorRegexp).test(text)) {
|
|
|
|
errorTxt.text = d.validatorErrMessage
|
|
|
|
return false
|
|
|
|
}
|
2024-10-15 10:45:50 +00:00
|
|
|
if(text.length > Constants.maxPasswordLength) {
|
|
|
|
errorTxt.text = d.passTooLongErrMessage
|
|
|
|
return false
|
|
|
|
}
|
2023-06-26 10:56:08 +00:00
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-03-22 09:29:59 +00:00
|
|
|
// Used to convert strength from a given score to a specific category
|
|
|
|
function convertStrength(score) {
|
|
|
|
var strength = StatusPasswordStrengthIndicator.Strength.None
|
|
|
|
switch(score) {
|
2022-05-23 12:36:23 +00:00
|
|
|
case 0: strength = StatusPasswordStrengthIndicator.Strength.VeryWeak; break
|
|
|
|
case 1: strength = StatusPasswordStrengthIndicator.Strength.Weak; break
|
|
|
|
case 2: strength = StatusPasswordStrengthIndicator.Strength.SoSo; break
|
|
|
|
case 3: strength = StatusPasswordStrengthIndicator.Strength.Good; break
|
|
|
|
case 4: strength = StatusPasswordStrengthIndicator.Strength.Great; break
|
2022-03-22 09:29:59 +00:00
|
|
|
}
|
|
|
|
if(strength > 4)
|
|
|
|
strength = StatusPasswordStrengthIndicator.Strength.Great
|
|
|
|
return strength
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Password validation / error message selection:
|
|
|
|
function passwordValidation() {
|
|
|
|
// 3 rules to validate:
|
|
|
|
// * Password is in pwnd passwords database
|
|
|
|
if(isInPwndDatabase())
|
2024-10-15 10:45:50 +00:00
|
|
|
errorTxt.text = qsTr("Password pwned, shouldn't be used")
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
// * Common password
|
|
|
|
else if(isCommonPassword())
|
2024-10-15 10:45:50 +00:00
|
|
|
errorTxt.text = qsTr("Common password, shouldn't be used")
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
// * Password too short
|
|
|
|
else if(isTooShort())
|
2024-10-15 10:45:50 +00:00
|
|
|
errorTxt.text = qsTr("Minimum %n character(s)", "", Constants.minPasswordLength)
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function isInPwndDatabase() {
|
|
|
|
// "TODO - Nice To Have: Pwnd password validation NOT implemented yet! "
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
function isCommonPassword() {
|
|
|
|
// "TODO - Nice To Have: Common password validation NOT implemented yet! "
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-11-21 07:30:11 +00:00
|
|
|
function isTooShort() { return newPswInput.text.length < Constants.minPasswordLength }
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
implicitWidth: 460
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.bigPadding
|
2022-03-01 15:59:38 +00:00
|
|
|
z: root.zFront
|
|
|
|
|
|
|
|
StatusBaseText {
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: root.contentAlignment
|
2022-03-01 15:59:38 +00:00
|
|
|
visible: root.titleVisible
|
|
|
|
text: root.title
|
2024-02-09 11:31:37 +00:00
|
|
|
font.pixelSize: root.titleSize
|
2022-03-01 15:59:38 +00:00
|
|
|
font.bold: true
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
2023-11-15 15:50:27 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: introColumn
|
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: root.contentAlignment
|
2023-11-15 15:50:27 +00:00
|
|
|
spacing: 4
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: root.contentAlignment
|
2023-11-15 15:50:27 +00:00
|
|
|
|
|
|
|
text: root.introText
|
2024-02-09 11:31:37 +00:00
|
|
|
horizontalAlignment: root.contentAlignment
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: root.highSizeIntro ? Theme.primaryTextFontSize : Theme.tertiaryTextFontSize
|
2023-11-15 15:50:27 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: root.contentAlignment
|
2023-11-15 15:50:27 +00:00
|
|
|
|
|
|
|
text: root.recoverText
|
2024-02-09 11:31:37 +00:00
|
|
|
horizontalAlignment: root.contentAlignment
|
2024-10-15 19:26:12 +00:00
|
|
|
font.pixelSize: root.highSizeIntro ? Theme.primaryTextFontSize : Theme.tertiaryTextFontSize
|
2023-11-15 15:50:27 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
ColumnLayout {
|
2024-03-29 13:21:21 +00:00
|
|
|
visible: !root.createNewPsw
|
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Current password")
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
StatusPasswordInput {
|
|
|
|
id: currentPswInput
|
|
|
|
objectName: "passwordViewCurrentPassword"
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
property bool showPassword
|
|
|
|
|
|
|
|
z: root.zFront
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: root.contentAlignment
|
|
|
|
placeholderText: qsTr("Enter current password")
|
|
|
|
echoMode: showPassword ? TextInput.Normal : TextInput.Password
|
2024-10-15 19:26:12 +00:00
|
|
|
rightPadding: showHideCurrentIcon.width + showHideCurrentIcon.anchors.rightMargin + Theme.padding / 2
|
2024-03-14 18:24:38 +00:00
|
|
|
onAccepted: root.returnPressed()
|
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: showHideCurrentIcon
|
|
|
|
visible: currentPswInput.text !== ""
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
icon.name: currentPswInput.showPassword ? "hide" : "show"
|
|
|
|
icon.color: Theme.palette.baseColor1
|
|
|
|
|
|
|
|
onClicked: currentPswInput.showPassword = !currentPswInput.showPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusModalDivider {
|
2024-03-29 13:21:21 +00:00
|
|
|
visible: !root.createNewPsw
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: root.contentAlignment
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-11 13:58:34 +00:00
|
|
|
ColumnLayout {
|
2022-03-01 15:59:38 +00:00
|
|
|
z: root.zFront
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: root.contentAlignment
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("New password")
|
|
|
|
}
|
|
|
|
|
2022-10-11 13:58:34 +00:00
|
|
|
StatusPasswordInput {
|
2022-03-01 15:59:38 +00:00
|
|
|
id: newPswInput
|
2022-10-11 13:58:34 +00:00
|
|
|
objectName: "passwordViewNewPassword"
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
property bool showPassword
|
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: root.contentAlignment
|
|
|
|
Layout.fillWidth: true
|
2024-03-14 18:24:38 +00:00
|
|
|
placeholderText: qsTr("Enter new password")
|
2022-10-11 13:58:34 +00:00
|
|
|
echoMode: showPassword ? TextInput.Normal : TextInput.Password
|
2024-10-15 19:26:12 +00:00
|
|
|
rightPadding: showHideNewIcon.width + showHideNewIcon.anchors.rightMargin + Theme.padding / 2
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
onTextChanged: {
|
|
|
|
// Update password checkers
|
2023-06-26 10:56:08 +00:00
|
|
|
errorTxt.text = ""
|
|
|
|
// Update strength indicator:
|
|
|
|
strengthInditactor.strength = d.convertStrength(root.passwordStrengthScoreFunction(newPswInput.text))
|
|
|
|
|
2022-03-01 15:59:38 +00:00
|
|
|
d.containsLower = d.lowerCaseValidator(text)
|
|
|
|
d.containsUpper = d.upperCaseValidator(text)
|
|
|
|
d.containsNumbers = d.numbersValidator(text)
|
|
|
|
d.containsSymbols = d.symbolsValidator(text)
|
|
|
|
|
2024-10-15 10:45:50 +00:00
|
|
|
if(!d.validateCharacterSet(text)) return
|
|
|
|
|
2022-10-11 13:58:34 +00:00
|
|
|
if (text.length === confirmPswInput.text.length) {
|
2022-05-23 12:36:23 +00:00
|
|
|
root.checkPasswordMatches(false)
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
2023-04-02 18:49:43 +00:00
|
|
|
onAccepted: root.returnPressed()
|
2022-03-01 15:59:38 +00:00
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: showHideNewIcon
|
|
|
|
visible: newPswInput.text !== ""
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
icon.name: newPswInput.showPassword ? "hide" : "show"
|
|
|
|
icon.color: Theme.palette.baseColor1
|
|
|
|
|
|
|
|
onClicked: newPswInput.showPassword = !newPswInput.showPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusPasswordStrengthIndicator {
|
|
|
|
id: strengthInditactor
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.fillWidth: true
|
2022-11-21 07:30:11 +00:00
|
|
|
value: Math.min(Constants.minPasswordLength, newPswInput.text.length)
|
2022-03-01 15:59:38 +00:00
|
|
|
from: 0
|
2022-11-21 07:30:11 +00:00
|
|
|
to: Constants.minPasswordLength
|
2022-03-01 15:59:38 +00:00
|
|
|
labelVeryWeak: qsTr("Very weak")
|
|
|
|
labelWeak: qsTr("Weak")
|
|
|
|
labelSoso: qsTr("So-so")
|
|
|
|
labelGood: qsTr("Good")
|
|
|
|
labelGreat: qsTr("Great")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.minimumHeight: 80
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
2024-03-11 11:31:37 +00:00
|
|
|
color: "transparent"
|
2024-10-15 19:26:12 +00:00
|
|
|
radius: Theme.radius
|
2024-02-09 11:31:37 +00:00
|
|
|
implicitHeight: strengthColumn.implicitHeight
|
|
|
|
implicitWidth: strengthColumn.implicitWidth
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: strengthColumn
|
|
|
|
anchors.fill: parent
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.margins: Theme.padding
|
2024-02-09 11:31:37 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.padding
|
2024-02-09 11:31:37 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: strengthenTxt
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
text: root.strengthenText
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
clip: true
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
RowLayout {
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.padding
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: lowerCaseTxt
|
|
|
|
text: "• " + qsTr("Lower case")
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: d.containsLower ? Theme.palette.successColor1 : Theme.palette.baseColor1
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: upperCaseTxt
|
|
|
|
text: "• " + qsTr("Upper case")
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: d.containsUpper ? Theme.palette.successColor1 : Theme.palette.baseColor1
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: numbersTxt
|
|
|
|
text: "• " + qsTr("Numbers")
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: d.containsNumbers ? Theme.palette.successColor1 : Theme.palette.baseColor1
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-02-09 11:31:37 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: symbolsTxt
|
|
|
|
text: "• " + qsTr("Symbols")
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: d.containsSymbols ? Theme.palette.successColor1 : Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
ColumnLayout {
|
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Confirm new password")
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
StatusPasswordInput {
|
|
|
|
id: confirmPswInput
|
|
|
|
objectName: "passwordViewNewPasswordConfirm"
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
property bool showPassword
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
z: root.zFront
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: root.contentAlignment
|
|
|
|
placeholderText: qsTr("Enter new password")
|
|
|
|
echoMode: showPassword ? TextInput.Normal : TextInput.Password
|
2024-10-15 19:26:12 +00:00
|
|
|
rightPadding: showHideConfirmIcon.width + showHideConfirmIcon.anchors.rightMargin + Theme.padding / 2
|
2023-06-26 10:56:08 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
onTextChanged: {
|
|
|
|
errorTxt.text = ""
|
2023-06-26 10:56:08 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
if(!d.validateCharacterSet(newPswInput.text)) return
|
2022-05-11 11:33:07 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
d.passwordValidation();
|
|
|
|
if(text.length === newPswInput.text.length) {
|
|
|
|
root.checkPasswordMatches()
|
|
|
|
}
|
2022-05-11 08:10:31 +00:00
|
|
|
}
|
2024-03-14 18:24:38 +00:00
|
|
|
|
|
|
|
onFocusChanged: {
|
|
|
|
// When clicking into the confirmation input, validate if new password:
|
|
|
|
if(focus) {
|
|
|
|
d.passwordValidation()
|
|
|
|
}
|
|
|
|
// When leaving the confirmation input because of the button or other input component is focused, check if password matches
|
|
|
|
else {
|
|
|
|
root.checkPasswordMatches(false)
|
|
|
|
}
|
2022-05-11 08:10:31 +00:00
|
|
|
}
|
2024-03-14 18:24:38 +00:00
|
|
|
onAccepted: root.returnPressed()
|
2022-03-01 15:59:38 +00:00
|
|
|
|
2024-03-14 18:24:38 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: showHideConfirmIcon
|
|
|
|
visible: confirmPswInput.text !== ""
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
icon.name: confirmPswInput.showPassword ? "hide" : "show"
|
|
|
|
icon.color: Theme.palette.baseColor1
|
|
|
|
|
|
|
|
onClicked: confirmPswInput.showPassword = !confirmPswInput.showPassword
|
|
|
|
}
|
2022-03-01 15:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: errorTxt
|
2024-02-09 11:31:37 +00:00
|
|
|
Layout.alignment: root.contentAlignment
|
2022-10-11 13:58:34 +00:00
|
|
|
Layout.fillHeight: true
|
2022-03-01 15:59:38 +00:00
|
|
|
font.pixelSize: 12
|
|
|
|
color: Theme.palette.dangerColor1
|
|
|
|
}
|
|
|
|
}
|