2 * Copyright (C) 2015-2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import QtQuick.Layouts 1.1
19 import Ubuntu.Components 1.3
20 import ".." as LocalComponents
21 import "../../Components"
24 * See the main passwd-type page for an explanation of why we don't actually
25 * directly set the password here.
28 LocalComponents.Page {
30 objectName: "passwdSetPage"
31 title: i18n.tr("Lock Screen Password")
32 forwardButtonSourceComponent: forwardButton
34 readonly property alias password: passwordField.text
35 readonly property alias password2: password2Field.text
36 readonly property bool passwordsMatching: password == password2 && password.trim().length > 7
41 flickableDirection: Flickable.VerticalFlick
43 anchors.leftMargin: parent.leftMargin
44 anchors.rightMargin: parent.rightMargin
45 anchors.topMargin: customMargin
47 bottomMargin: Qt.inputMethod.keyboardRectangle.height - height
49 Behavior on contentY { UbuntuNumberAnimation {} }
54 objectName: "infoLabel"
60 font.weight: Font.Light
62 text: i18n.tr("Enter at least 8 characters")
72 topMargin: units.gu(3)
74 text: i18n.tr("Choose password")
77 LocalComponents.WizardTextField {
82 top: pass1Label.bottom
83 topMargin: units.gu(1)
85 objectName: "passwordField"
86 echoMode: TextInput.Password
87 onAccepted: password2Field.forceActiveFocus()
88 onActiveFocusChanged: {
90 column.contentY = pass1Label.y
101 top: passwordField.bottom
102 topMargin: units.gu(3)
104 text: i18n.tr("Confirm password")
107 LocalComponents.WizardTextField {
111 top: pass2Label.bottom
112 topMargin: units.gu(1)
115 objectName: "password2Field"
116 echoMode: TextInput.Password
117 onActiveFocusChanged: {
119 column.contentY = pass2Label.y
125 LocalComponents.PasswordMeter {
130 top: password2Field.bottom
131 topMargin: units.gu(1)
134 password: passwordField.text
135 matching: passwordsMatching ? true : (password2.trim().length > 0 ? false : undefined)
141 LocalComponents.StackButton {
142 text: i18n.tr("Next")
143 enabled: passwordsMatching
145 root.password = password;