Mercurial > gemma
annotate client/src/components/Passwordfield.vue @ 488:9a3b6dae0939
fix: Added (now) styled component of Passwordfield
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 24 Aug 2018 14:09:57 +0200 |
parents | |
children | 6fbd5b83ae04 |
rev | line source |
---|---|
488
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <label for="password">{{this.label}}</label> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 <div class="d-flex d-row"> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <input :type="isPasswordVisible" @change="fieldChanged" class="form-control" :placeholder='placeholder' required> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 <span class="input-group-text" @click="showPassword"><i :class="eyeIcon"></i></span> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 </div> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 <div v-show="passworderrors" class="text-danger"><small><i class="fa fa-warning"></i> {{ this.passworderrors}}</small></div> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 </div> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
10 </template> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 <script> |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 export default { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 name: "passwordfield", |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 props: ["model", "placeholder", "label", "passworderrors"], |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 data() { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 return { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 password: "", |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 readablePassword: false |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 }; |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 }, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 methods: { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 showPassword() { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 this.readablePassword = !this.readablePassword; |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 }, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 fieldChanged(e) { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 this.$emit("fieldchange", e.target.value); |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 } |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 }, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 computed: { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 isPasswordVisible() { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 return this.readablePassword ? "text" : "password"; |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
33 }, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
34 eyeIcon() { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 return { |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 fa: true, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 "fa-eye": !this.readablePassword, |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 "fa-eye-slash": this.readablePassword |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 }; |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 } |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 } |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 }; |
9a3b6dae0939
fix: Added (now) styled component of Passwordfield
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 </script> |