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
23
* See the main passwd-type page for an explanation of why we don't actually
24
* directly set the password here.
27
LocalComponents.Page {
29
objectName: "passwdSetPage"
30
title: i18n.tr("Lock Screen Password")
31
forwardButtonSourceComponent: forwardButton
33
readonly property alias password: passwordField.text
34
readonly property alias password2: password2Field.text
35
readonly property bool passwordsMatching: password == password2 && password.trim().length > 7
40
flickableDirection: Flickable.VerticalFlick
42
anchors.leftMargin: parent.leftMargin
43
anchors.rightMargin: parent.rightMargin
44
anchors.topMargin: customMargin
46
bottomMargin: Qt.inputMethod.keyboardRectangle.height - height
48
Behavior on contentY { UbuntuNumberAnimation {} }
53
objectName: "infoLabel"
59
font.weight: Font.Light
61
text: i18n.tr("Enter at least 8 characters")
71
topMargin: units.gu(3)
73
text: i18n.tr("Choose password")
76
LocalComponents.WizardTextField {
81
top: pass1Label.bottom
82
topMargin: units.gu(1)
84
objectName: "passwordField"
85
echoMode: TextInput.Password
86
onAccepted: password2Field.forceActiveFocus()
87
onActiveFocusChanged: {
89
column.contentY = pass1Label.y
100
top: passwordField.bottom
101
topMargin: units.gu(3)
103
text: i18n.tr("Confirm password")
106
LocalComponents.WizardTextField {
110
top: pass2Label.bottom
111
topMargin: units.gu(1)
114
objectName: "password2Field"
115
echoMode: TextInput.Password
116
onActiveFocusChanged: {
118
column.contentY = pass2Label.y
124
LocalComponents.PasswordMeter {
129
top: password2Field.bottom
130
topMargin: units.gu(1)
133
password: passwordField.text
134
matching: passwordsMatching ? true : (password2.trim().length > 0 ? false : undefined)
140
LocalComponents.StackButton {
141
text: i18n.tr("Next")
142
enabled: passwordsMatching
144
root.password = password;