status-desktop/ui/app/AppLayouts/Onboarding/views/CreatePasswordView.qml
Alexandra Betouni 480985ca4e
[Settings]: Added change password view (#13284)
* [Settings]: Added change password view

Closes #10037

Adding configuration options to PasswordView

* feat(ChangePassword): Integrate ConfirmChangePasswordModal

1. Integrate with backend
2. Clean unused components

* feat: Add support to restart application

1. Adding restart app support in DOtherSide
2. Integrating nimqml
3. Expose in qml in Utils

* chore: Move changeDatabasePassword call to threadpool

* chore(squish): Fix failing tests due to settings index changes

---------

Co-authored-by: Alex Jbanca <alexjb@status.im>
2024-02-09 13:31:37 +02:00

63 lines
1.8 KiB
QML

import QtQuick 2.0
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.12
import StatusQ.Controls 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
import utils 1.0
import shared.views 1.0
import "../controls"
import "../stores"
Item {
id: root
property StartupStore startupStore
Component.onCompleted: {
view.newPswText = root.startupStore.getPassword()
view.confirmationPswText = root.startupStore.getPassword()
d.forcePasswordInputFocus()
}
QtObject {
id: d
readonly property int zBehind: 1
readonly property int zFront: 100
function submit() {
root.startupStore.setDefaultWalletEmoji(StatusQUtils.Emoji.getRandomEmoji(StatusQUtils.Emoji.size.verySmall))
root.startupStore.setPassword(view.newPswText)
root.startupStore.doPrimaryAction()
}
function forcePasswordInputFocus() { view.forceNewPswInputFocus() }
}
ColumnLayout {
spacing: Style.current.bigPadding
anchors.centerIn: parent
height: 460
z: view.zFront
PasswordView {
id: view
Layout.preferredWidth: root.width - 2 * Style.current.bigPadding
Layout.maximumWidth: 460
Layout.fillHeight: true
passwordStrengthScoreFunction: root.startupStore.getPasswordStrengthScore
highSizeIntro: true
onReturnPressed: { if(view.ready) d.submit() }
}
StatusButton {
id: submitBtn
objectName: "onboardingCreatePasswordButton"
z: d.zFront
Layout.alignment: Qt.AlignHCenter
text: qsTr("Create password")
enabled: view.ready
onClicked: { d.submit() }
}
}
}