changeset 491:89682badcd3a

merge (was too slow).
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 24 Aug 2018 14:11:10 +0200
parents 4b39e7f651ed (current diff) 9a3b6dae0939 (diff)
children 5a9dde6951ae
files
diffstat 1 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/components/Passwordfield.vue	Fri Aug 24 14:11:10 2018 +0200
@@ -0,0 +1,43 @@
+<template>
+  <div>
+    <label for="password">{{this.label}}</label>
+    <div class="d-flex d-row">
+      <input :type="isPasswordVisible" @change="fieldChanged" class="form-control" :placeholder='placeholder' required>
+      <span class="input-group-text" @click="showPassword"><i :class="eyeIcon"></i></span>
+    </div>
+    <div v-show="passworderrors" class="text-danger"><small><i class="fa fa-warning"></i> {{ this.passworderrors}}</small></div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "passwordfield",
+  props: ["model", "placeholder", "label", "passworderrors"],
+  data() {
+    return {
+      password: "",
+      readablePassword: false
+    };
+  },
+  methods: {
+    showPassword() {
+      this.readablePassword = !this.readablePassword;
+    },
+    fieldChanged(e) {
+      this.$emit("fieldchange", e.target.value);
+    }
+  },
+  computed: {
+    isPasswordVisible() {
+      return this.readablePassword ? "text" : "password";
+    },
+    eyeIcon() {
+      return {
+        fa: true,
+        "fa-eye": !this.readablePassword,
+        "fa-eye-slash": this.readablePassword
+      };
+    }
+  }
+};
+</script>