2 * Copyright (C) 2014 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 Ubuntu.Components 1.3
19 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20 import ".." as LocalComponents
21 import "../../Components" as UnityComponents
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 forwardButtonSourceComponent: forwardButton
33 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
35 // If we are entering this page, clear any saved password and get focus
36 onEnabledChanged: if (enabled) lockscreen.clear(false)
39 root.password = lockscreen.passphrase;
45 interval: UbuntuAnimation.SnapDuration
46 onTriggered: pageStack.load(Qt.resolvedUrl("passwd-confirm.qml"));
49 UnityComponents.Lockscreen {
54 leftMargin: leftMargin
55 rightMargin: rightMargin
56 bottomMargin: buttonMargin
59 infoText: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase ?
60 i18n.tr("Enter passphrase") :
61 i18n.tr("Choose your passcode")
63 // Note that the number four comes from PAM settings,
64 // which we don't have a good way to interrogate. We
65 // only do this matching instead of PAM because we want
66 // to set the password via PAM in a different place
67 // than this page. See comments at top of passwd-type file.
68 errorText: i18n.tr("Passphrase must be 4 characters long")
70 showEmergencyCallButton: false
71 showCancelButton: false
72 alphaNumeric: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
77 if (passphrase.length >= 4) {
78 passwdSetPage.confirm();
80 lockscreen.clear(true)
87 LocalComponents.StackButton {
88 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
89 enabled: lockscreen.passphrase.length >= 4
90 text: i18n.tr("Continue")
91 onClicked: passwdSetPage.confirm()