Merge lp:~jonas-drange/ubuntu-system-settings/security-pass-input-fix-1357548 into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 1248
Merged at revision: 1253
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/security-pass-input-fix-1357548
Merge into: lp:ubuntu-system-settings
Diff against target: 139 lines (+60/-25)
1 file modified
plugins/security-privacy/LockSecurity.qml (+60/-25)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/security-pass-input-fix-1357548
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Matthew Paul Thomas (community) Needs Information
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+245980@code.launchpad.net

Commit message

[security] replace inputmask for validator and maximum length

Description of the change

[security] replace inputmask for validator and maximum length

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

On Fri, Jan 09, 2015 at 04:20:36PM -0000, Jonas G. Drange wrote:
> Jonas G. Drange has proposed merging lp:~jonas-drange/ubuntu-system-settings/security-pass-input-fix-1357548 into lp:ubuntu-system-settings.
>
> Commit message:
> [security] replace inputmask for validator and maximum length

Are you saying with this that the UITK is not going to change?

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

In a couple of places you have the IntValidator bottom as 1000, I think this should be 0.

review: Needs Fixing
1248. By Jonas G. Drange

using new method

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Matthew Paul Thomas (mpt) wrote :

I'm delighted that this confusing bug is being fixed! I am not an engineer, and I might be greatly misunderstanding what is going on ... But this approach does not look right to me.

Pat wrote in bug 1357548 that "We currently set an inputMask of '9999' which causes the pre-population of asterisks". From what I can tell, you have then brainstormed a way to achieve the same effect as an inputMask, without using inputMask. Correct?

If so, this has two problems. First, the code is longer.

Second, if any third-party developer writes an app containing a password field, where the password characters need to be restricted in any way, they might reasonably read <https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Components.TextField/#inputMask-prop> and think that using an inputMask is a good way to achieve that. But if they do, they will have exactly the same bug in their app: weird bullet characters in an empty field. Right? It will be a booby-trap in the toolkit.

Either inputMask is a good idea or it isn't. If it is, ubuntu-system-settings should continue using it, and this bug should be fixed in the toolkit. And if it isn't, it shouldn't be in the toolkit at all.

review: Needs Information
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good, works around the issue nicely.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/security-privacy/LockSecurity.qml'
2--- plugins/security-privacy/LockSecurity.qml 2014-10-31 08:45:10 +0000
3+++ plugins/security-privacy/LockSecurity.qml 2015-01-12 13:31:35 +0000
4@@ -70,6 +70,11 @@
5 dlg.newMethod = newMethod
6 }
7
8+ RegExpValidator {
9+ id: passcodeValidator
10+ regExp: /\d{4}/
11+ }
12+
13 Component {
14 id: dialogComponent
15
16@@ -142,13 +147,6 @@
17 else
18 return Qt.ImhNone
19 }
20- inputMask: {
21- if (changeSecurityDialog.oldMethod ===
22- UbuntuSecurityPrivacyPanel.Passcode)
23- return "9999"
24- else
25- return ""
26- }
27 visible: changeSecurityDialog.oldMethod ===
28 UbuntuSecurityPrivacyPanel.Passphrase ||
29 changeSecurityDialog.oldMethod ===
30@@ -160,6 +158,24 @@
31 }
32 }
33
34+ /* Using bindings since it is, according to documentation,
35+ impossible to unset both validator and maximumLength properties */
36+ Binding {
37+ target: currentInput
38+ property: "validator"
39+ value: passcodeValidator
40+ when: changeSecurityDialog.oldMethod ===
41+ UbuntuSecurityPrivacyPanel.Passcode
42+ }
43+
44+ Binding {
45+ target: currentInput
46+ property: "maximumLength"
47+ value: 4
48+ when: changeSecurityDialog.oldMethod ===
49+ UbuntuSecurityPrivacyPanel.Passcode
50+ }
51+
52 Label {
53 id: incorrect
54 text: ""
55@@ -197,20 +213,28 @@
56 else
57 return Qt.ImhNone
58 }
59- inputMask: {
60- if (changeSecurityDialog.newMethod ===
61- UbuntuSecurityPrivacyPanel.Passcode)
62- return "9999"
63- else
64- return ""
65- }
66 visible: changeSecurityDialog.newMethod ===
67 UbuntuSecurityPrivacyPanel.Passcode ||
68 changeSecurityDialog.newMethod ===
69 UbuntuSecurityPrivacyPanel.Passphrase
70- // Doesn't get updated if you set this in enabled of confirmButton
71- onTextChanged: confirmButton.enabled =
72- (acceptableInput && (!visible || text.length > 0))
73+ }
74+
75+ /* Using bindings since it is, according to documentation,
76+ impossible to unset both validator and maximumLength properties */
77+ Binding {
78+ target: newInput
79+ property: "validator"
80+ value: passcodeValidator
81+ when: changeSecurityDialog.newMethod ===
82+ UbuntuSecurityPrivacyPanel.Passcode
83+ }
84+
85+ Binding {
86+ target: newInput
87+ property: "maximumLength"
88+ value: 4
89+ when: changeSecurityDialog.newMethod ===
90+ UbuntuSecurityPrivacyPanel.Passcode
91 }
92
93 Label {
94@@ -243,19 +267,30 @@
95 else
96 return Qt.ImhNone
97 }
98- inputMask: {
99- if (changeSecurityDialog.newMethod ===
100- UbuntuSecurityPrivacyPanel.Passcode)
101- return "9999"
102- else
103- return ""
104- }
105 visible: changeSecurityDialog.newMethod ===
106 UbuntuSecurityPrivacyPanel.Passcode ||
107 changeSecurityDialog.newMethod ===
108 UbuntuSecurityPrivacyPanel.Passphrase
109 }
110
111+ /* Using bindings since it is, according to documentation,
112+ impossible to unset both validator and maximumLength properties */
113+ Binding {
114+ target: confirmInput
115+ property: "validator"
116+ value: passcodeValidator
117+ when: changeSecurityDialog.newMethod ===
118+ UbuntuSecurityPrivacyPanel.Passcode
119+ }
120+
121+ Binding {
122+ target: confirmInput
123+ property: "maximumLength"
124+ value: 4
125+ when: changeSecurityDialog.newMethod ===
126+ UbuntuSecurityPrivacyPanel.Passcode
127+ }
128+
129 Label {
130 id: notMatching
131 wrapMode: Text.Wrap
132@@ -303,7 +338,7 @@
133 else
134 return i18n.tr("Set")
135 }
136- enabled: false
137+ enabled: newInput.acceptableInput
138 onClicked: {
139 changeSecurityDialog.enabled = false
140

Subscribers

People subscribed via source and target branches