1e41f4b71Sopenharmony_ci# PatternLock
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **PatternLock** component allows users to use a pattern password for authentication. It enters the input state once a finger is pressed against it, and exits the input state and completes the input once the finger leaves the screen.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Child Components
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciNot supported
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci##  APIs
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciPatternLock(controller?: PatternLockController)
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Parameters**
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci| Name    | Type                                       | Mandatory| Description|
24e41f4b71Sopenharmony_ci| ---------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ |
25e41f4b71Sopenharmony_ci| controller | [PatternLockController](#patternlockcontroller) | No  | Controller of a component to reset the component status.      |
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci## Attributes
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciIn addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci### sideLength
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_cisideLength(value: Length)
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ciSets the width and height (same value) of the component. If this attribute is set to **0** or a negative number, the component is not displayed.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Parameters**
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci| Name| Type                        | Mandatory| Description              |
44e41f4b71Sopenharmony_ci| ------ | ---------------------------- | ---- | ------------------ |
45e41f4b71Sopenharmony_ci| value  | [Length](ts-types.md#length) | Yes  | Width and height of the component. Default value: **288vp**|
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci### circleRadius
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_cicircleRadius(value: Length)
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciSets the radius of the grid dot. If this attribute is set to **0** or a negative value, the default value is used.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci**Parameters**
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci| Name| Type                        | Mandatory| Description                              |
60e41f4b71Sopenharmony_ci| ------ | ---------------------------- | ---- | ---------------------------------- |
61e41f4b71Sopenharmony_ci| value  | [Length](ts-types.md#length) | Yes  | Radius of the grid dot.<br>Default value: **6vp**|
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci### backgroundColor
64e41f4b71Sopenharmony_cibackgroundColor(value: ResourceColor)
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ciSets the background color.
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci| Name| Type                                      | Mandatory| Description                                                      |
73e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | ---------------------------------------------------------- |
74e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Background color.|
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci### regularColor
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ciregularColor(value: ResourceColor)
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ciSets the fill color of the grid dot in the unselected state.
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci**Parameters**
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci| Name| Type                                      | Mandatory| Description                                                      |
89e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | ---------------------------------------------------------- |
90e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Fill color of the grid dot in the unselected state.<br>Default value: **'#ff182431'**|
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci### selectedColor
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ciselectedColor(value: ResourceColor)
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ciSets the fill color of the grid dot in the selected state.
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci**Parameters**
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci| Name| Type                                      | Mandatory| Description                                                    |
105e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | -------------------------------------------------------- |
106e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Fill color of the grid dot in the selected state.<br>Default value: **'#ff182431'**|
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci### activeColor
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ciactiveColor(value: ResourceColor)
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ciSets the fill color of the grid dot in the activated state, which is when the dot is highlighted but not selected.
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci**Parameters**
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci| Name| Type                                      | Mandatory| Description                                                    |
121e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | -------------------------------------------------------- |
122e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Fill color of the grid dot in the activated state.<br>Default value: **'#ff182431'**|
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci### pathColor
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_cipathColor(value: ResourceColor)
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ciSets the path color.
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci**Parameters**
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci| Name| Type                                      | Mandatory| Description                                |
137e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | ------------------------------------ |
138e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Path color.<br>Default value: **'#33182431' **|
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci### pathStrokeWidth
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_cipathStrokeWidth(value: number | string)
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ciSets the width of the path stroke. If this attribute is set to **0** or a negative value, the path stroke is not displayed.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci**Parameters**
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci| Name| Type                      | Mandatory| Description                         |
153e41f4b71Sopenharmony_ci| ------ | -------------------------- | ---- | ----------------------------- |
154e41f4b71Sopenharmony_ci| value  | number \| string | Yes  | Wdth of the path stroke.<br>Default value: **12vp**|
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci### autoReset
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ciautoReset(value: boolean)
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ciSets whether to allow the user to reset the component status (that is, clear the input) by touching the component again after the input is complete.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Parameters**
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci| Name| Type   | Mandatory| Description                                                        |
169e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
170e41f4b71Sopenharmony_ci| value  | boolean | Yes  | Whether to allow the user to reset the component status (that is, clear the input) by touching the component again after the input is complete.<br>The value **true** means that the user can reset the component status by touching the component again after the input is complete, and **false** means the opposite.<br>Default value: **true**|
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci### activateCircleStyle<sup>12+</sup>
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ciactivateCircleStyle(options: Optional\<CircleStyleOptions\>)
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ciSets the background circle style of the grid dot in the activated state.
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ci**Parameters**
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci| Name| Type   | Mandatory| Description                                                        |
185e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ |
186e41f4b71Sopenharmony_ci| options  | [CircleStyleOptions](#circlestyleoptions12)| Yes  | Background circle style of the grid dot in the activated state.|
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci## CircleStyleOptions<sup>12+</sup>
189e41f4b71Sopenharmony_ci
190e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
193e41f4b71Sopenharmony_ci
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci| Name         | Type| Mandatory| Description|
196e41f4b71Sopenharmony_ci| ------------- | ------- | ---- | -------- |
197e41f4b71Sopenharmony_ci| color | [ResourceColor](ts-types.md#resourcecolor) | No| Color of the background circle.<br>Default value: same as the value of **pathColor**|
198e41f4b71Sopenharmony_ci| radius  | [LengthMetrics](../js-apis-arkui-graphics.md#lengthmetrics12) | No| Radius of the background circle.<br>Default value: 11/6 of **circleRadius**|
199e41f4b71Sopenharmony_ci| enableWaveEffect | boolean | No| Whether to enable the wave effect.<br>Default value: **true**|
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ci## Events
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ciIn addition to the [universal events](ts-universal-events-click.md), the following events are supported.
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ci### onPatternComplete
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_cionPatternComplete(callback: (input: Array\<number\>) => void)
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ciInvoked when the pattern password input is complete.
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
212e41f4b71Sopenharmony_ci
213e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci**Parameters**
216e41f4b71Sopenharmony_ci
217e41f4b71Sopenharmony_ci| Name| Type           | Mandatory| Description                                                        |
218e41f4b71Sopenharmony_ci| ------ | --------------- | ---- | ------------------------------------------------------------ |
219e41f4b71Sopenharmony_ci| input  | Array\<number\> | Yes  | Array of digits that are the indexes of the connected grid dots and are arranged in the same sequence as the dots are connected. The indexes of the grid dots are as follows: 0, 1, 2 for the dots in the first row from left to right; 3, 4, 5 for the dots in the second row; 6, 7, 8 for the dots in the third row.|
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci### onDotConnect<sup>11+</sup>
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_cionDotConnect(callback: [CallBack](../../apis-basic-services-kit/js-apis-base.md#callback)\<number\>)
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ciInvoked when a grid dot is connected during pattern password input.
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ciThe callback parameter is a digit that is the index of the connected grid dot. The indexes of the grid dots are as follows: 0, 1, 2 for the dots in the first row from left to right; 3, 4, 5 for the dots in the second row; 6, 7, 8 for the dots in the third row.
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci## PatternLockController
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ciImplements the controller bound to the **PatternLock** component for resetting the component status.
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci### Objects to Import
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci```typescript
240e41f4b71Sopenharmony_cilet patternLockController: PatternLockController = new PatternLockController()
241e41f4b71Sopenharmony_ci```
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci### reset
248e41f4b71Sopenharmony_ci
249e41f4b71Sopenharmony_cireset()
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ciResets the component status.
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci### setChallengeResult<sup>11+</sup>
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_cisetChallengeResult(result: PatternLockChallengeResult): void
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ciSets the authentication challenge result for the pattern password.
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci| Name  | Type                                                    | Mandatory| Description      |
268e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | -------------- |
269e41f4b71Sopenharmony_ci| result | [PatternLockChallengeResult](#patternlockchallengeresult11) | Yes  | Authentication challenge result of the pattern password.|
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci## PatternLockChallengeResult<sup>11+</sup>
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci| Name   | Description          |
278e41f4b71Sopenharmony_ci| ------- | -------------- |
279e41f4b71Sopenharmony_ci| CORRECT | The pattern password is correct.|
280e41f4b71Sopenharmony_ci| WRONG   | The pattern password is incorrect.|
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci##  Example
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ci```ts
285e41f4b71Sopenharmony_ci// xxx.ets
286e41f4b71Sopenharmony_ciimport { LengthUnit } from '@kit.ArkUI'
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci@Entry
289e41f4b71Sopenharmony_ci@Component
290e41f4b71Sopenharmony_cistruct PatternLockExample {
291e41f4b71Sopenharmony_ci  @State passwords: Number[] = []
292e41f4b71Sopenharmony_ci  @State message: string = 'please input password!'
293e41f4b71Sopenharmony_ci  private patternLockController: PatternLockController = new PatternLockController()
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci  build() {
296e41f4b71Sopenharmony_ci    Column() {
297e41f4b71Sopenharmony_ci      Text(this.message).textAlign(TextAlign.Center).margin(20).fontSize(20)
298e41f4b71Sopenharmony_ci      PatternLock(this.patternLockController)
299e41f4b71Sopenharmony_ci        .sideLength(200)
300e41f4b71Sopenharmony_ci        .circleRadius(9)
301e41f4b71Sopenharmony_ci        .pathStrokeWidth(18)
302e41f4b71Sopenharmony_ci        .activeColor('#B0C4DE')
303e41f4b71Sopenharmony_ci        .selectedColor('#228B22')
304e41f4b71Sopenharmony_ci        .pathColor('#90EE90')
305e41f4b71Sopenharmony_ci        .backgroundColor('#F5F5F5')
306e41f4b71Sopenharmony_ci        .autoReset(true)
307e41f4b71Sopenharmony_ci        .activateCircleStyle({
308e41f4b71Sopenharmony_ci          color: '#90EE90',
309e41f4b71Sopenharmony_ci          radius: { value: 16, unit: LengthUnit.VP },
310e41f4b71Sopenharmony_ci          enableWaveEffect: true
311e41f4b71Sopenharmony_ci        })
312e41f4b71Sopenharmony_ci        .onDotConnect((index: number) => {
313e41f4b71Sopenharmony_ci          console.log("onDotConnect index: " + index)
314e41f4b71Sopenharmony_ci        })
315e41f4b71Sopenharmony_ci        .onPatternComplete((input: Array<number>) => {
316e41f4b71Sopenharmony_ci          // If the length of the entered password is less than 5, the system prompts the user to enter the password again.
317e41f4b71Sopenharmony_ci          if (input === null || input === undefined || input.length < 5) {
318e41f4b71Sopenharmony_ci            this.message = 'The password length needs to be greater than 5, please enter again.'
319e41f4b71Sopenharmony_ci            return
320e41f4b71Sopenharmony_ci          }
321e41f4b71Sopenharmony_ci          // Check whether the password length is greater than 0.
322e41f4b71Sopenharmony_ci          if (this.passwords.length > 0) {
323e41f4b71Sopenharmony_ci            // Check whether the two passwords are the same. If yes, the system displays a message indicating that the password is set successfully. If no, the system prompts the user to enter the password again.
324e41f4b71Sopenharmony_ci            if (this.passwords.toString() === input.toString()) {
325e41f4b71Sopenharmony_ci              this.passwords = input
326e41f4b71Sopenharmony_ci              this.message = 'Set password successfully: ' + this.passwords.toString()
327e41f4b71Sopenharmony_ci              this.patternLockController.setChallengeResult(PatternLockChallengeResult.CORRECT)
328e41f4b71Sopenharmony_ci            } else {
329e41f4b71Sopenharmony_ci              this.message = 'Inconsistent passwords, please enter again.'
330e41f4b71Sopenharmony_ci              this.patternLockController.setChallengeResult(PatternLockChallengeResult.WRONG)
331e41f4b71Sopenharmony_ci            }
332e41f4b71Sopenharmony_ci          } else {
333e41f4b71Sopenharmony_ci            // The system prompts the user to enter the password again.
334e41f4b71Sopenharmony_ci            this.passwords = input
335e41f4b71Sopenharmony_ci            this.message = "Please enter again."
336e41f4b71Sopenharmony_ci          }
337e41f4b71Sopenharmony_ci        })
338e41f4b71Sopenharmony_ci      Button('Reset PatternLock').margin(30).onClick(() => {
339e41f4b71Sopenharmony_ci        // Reset the pattern lock.
340e41f4b71Sopenharmony_ci        this.patternLockController.reset()
341e41f4b71Sopenharmony_ci        this.passwords = []
342e41f4b71Sopenharmony_ci        this.message = 'Please input password'
343e41f4b71Sopenharmony_ci      })
344e41f4b71Sopenharmony_ci    }.width('100%').height('100%')
345e41f4b71Sopenharmony_ci  }
346e41f4b71Sopenharmony_ci}
347e41f4b71Sopenharmony_ci```
348e41f4b71Sopenharmony_ci
349e41f4b71Sopenharmony_ci![patternlock](figures/patternlock.gif)
350