view client/src/components/usermanagement/Passwordfield.vue @ 5348:45b03e8ca47e extented-report

Toggles in user overview and in details section as well established This commit introduces toggles to change the state for administrative users to be able to receive the DQL Report. For quick access there is the possibility to change via overview. If you want to edit this in the details or if you change the role of the user to a non administrative, there is the possibility to change the flag in a fast way. When the user looses administrative privilege the option is not available and the according flag is set to "false". Aside: Changed user.go to resolve inconsitencies in frontend where the key "reports" was missing due to "omitempty" in marshalling the go objects.
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 21 Jun 2021 16:41:39 +0200
parents 6c5364ff0abb
children
line wrap: on
line source

<template>
  <div class="w-100">
    <div class="d-flex flex-row">
      <label for="password">{{ this.label }}</label>
    </div>
    <div class="d-flex d-row">
      <input
        :type="isPasswordVisible"
        @change="fieldChanged"
        class="form-control"
        :placeholder="placeholder"
        :required="required"
      />
      <span class="input-group-text" @click="showPassword">
        <font-awesome-icon :icon="readablePassword ? 'eye-slash' : 'eye'" />
      </span>
    </div>
    <div v-show="passworderrors" class="text-danger">
      <small>
        <font-awesome-icon icon="exclamation-triangle" />
        {{ this.passworderrors }}
      </small>
    </div>
  </div>
</template>

<style>
/* FIXME does not work here, unclear why, so added to Login.vue
input[type="password"]::-ms-reveal {
  display: none;
} */
</style>

<script>
/* This is Free Software under GNU Affero General Public License v >= 3.0
 * without warranty, see README.md and license for details.
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * License-Filename: LICENSES/AGPL-3.0.txt
 *
 * Copyright (C) 2018 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Thomas Junk <thomas.junk@intevation.de>
 */
export default {
  name: "passwordfield",
  props: ["model", "placeholder", "label", "passworderrors", "required"],
  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";
    }
  }
};
</script>