From c360807e238fd8459d4015761bae167691d692cf Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 3 Feb 2021 12:42:05 +0300 Subject: [PATCH] Fixed #892 - show password feature --- src/assets/styles/primevue.css | 1 - src/components/password/Password.d.ts | 2 + src/components/password/Password.vue | 127 ++++++++++++++++-- .../password/images/password-meter.png | Bin 118 -> 0 bytes src/views/password/PasswordDemo.vue | 38 +++++- src/views/password/PasswordDoc.vue | 34 +++++ 6 files changed, 185 insertions(+), 17 deletions(-) delete mode 100755 src/components/password/images/password-meter.png diff --git a/src/assets/styles/primevue.css b/src/assets/styles/primevue.css index ac544b3a0..0f0e625ec 100644 --- a/src/assets/styles/primevue.css +++ b/src/assets/styles/primevue.css @@ -4,7 +4,6 @@ @import '../../components/checkbox/Checkbox.css'; @import '../../components/colorpicker/ColorPicker.css'; @import '../../components/inputtext/InputText.css'; -@import '../../components/password/Password.css'; @import '../../components/radiobutton/RadioButton.css'; @import '../../components/ripple/Ripple.css'; @import '../../components/tooltip/Tooltip.css'; \ No newline at end of file diff --git a/src/components/password/Password.d.ts b/src/components/password/Password.d.ts index 78de36621..8cb40b876 100755 --- a/src/components/password/Password.d.ts +++ b/src/components/password/Password.d.ts @@ -9,6 +9,8 @@ declare class Password extends Vue { mediumLabel?: string; strongLabel?: string; feedback?: boolean; + appendTo?: string; + toggleMask?: boolean; $emit(eventName: string, event: Event): this; } diff --git a/src/components/password/Password.vue b/src/components/password/Password.vue index d4b6cc591..8404a3d97 100755 --- a/src/components/password/Password.vue +++ b/src/components/password/Password.vue @@ -1,19 +1,24 @@ + + diff --git a/src/components/password/images/password-meter.png b/src/components/password/images/password-meter.png deleted file mode 100755 index ddb456d3f8014647b6b193ceaf506e91f72fe819..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^(|}lmi5W;Hu76zuq<8{+LR>$7{P
- +
Basic
+ + +
Password Meter
+ + +
Show Password
+ + +
Templating
+ + + +
@@ -24,7 +49,10 @@ import PasswordDoc from './PasswordDoc'; export default { data() { return { - value: '' + value1: null, + value2: null, + value3: null, + value4: null } }, components: { @@ -32,3 +60,9 @@ export default { } } + + diff --git a/src/views/password/PasswordDoc.vue b/src/views/password/PasswordDoc.vue index f4e2adebf..b8d42056a 100755 --- a/src/views/password/PasswordDoc.vue +++ b/src/views/password/PasswordDoc.vue @@ -39,6 +39,28 @@ import Password from 'primevue/password';

It is possible to define your own checks with the mediumRegex and strongRegex properties.

+
Templating
+

3 slots are included to customize the overlay. These are header, content and footer. Note that content overrides the default meter.

+
+
+<Password v-model="value4">
+    <template #header>
+        <h6>Pick a password</h6>
+    </template>
+    <template #footer>
+        <Divider />
+        <p class="p-mt-2">Suggestions</p>
+        <ul class="p-pl-2 p-ml-2 p-mt-0" style="line-height: 1.5">
+            <li>At least one lowercase</li>
+            <li>At least one uppercase</li>
+            <li>At least one numeric</li>
+            <li>Minimum 8 characters</li>
+        </ul>
+    </template>
+</Password>
+
+
+
Properties

Any property such as name and placeholder are passed to the underlying input element. Following are the additional properties to configure the component.

@@ -99,6 +121,18 @@ import Password from 'primevue/password'; boolean true Whether to show the strength indicator or not. + + + toggleMask + boolean + false + Whether to show an icon to display the password as plain text. + + + appendTo + string + null + Id of the element or "body" for document where the overlay should be appended to.