changeset 502:af1a198391f3 metamorph-for-all

Merged default into metamorph-for-all branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 24 Aug 2018 15:33:33 +0200
parents c10c76c92797 (current diff) f6d61657b487 (diff)
children 21a4c7ef871b
files client/.env.sample
diffstat 10 files changed, 104 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Aug 24 15:30:31 2018 +0200
+++ b/.hgignore	Fri Aug 24 15:33:33 2018 +0200
@@ -73,8 +73,8 @@
 # Yarn Integrity file
 .yarn-integrity
 
-# dotenv environment variables file
-.env
+# local dotenv environment variables file
+.env.local
 
 ### Vim ###
 # swap
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/.env	Fri Aug 24 15:33:33 2018 +0200
@@ -0,0 +1,12 @@
+#Name of the application, e.g. displayed at login time
+VUE_APP_TITLE=Waterway Monitoring system
+
+#Backend URL
+VUE_APP_API_URL=/api/
+VUE_BACKEND_API_URL=http://gemma_backend:8000
+
+#URL of secondary logo
+VUE_APP_SECONDARY_LOGO_URL=
+
+#Path of vendored images is copied during a webpack build
+VUE_APP_VENDOR_IMG_PATH=
--- a/client/.env.sample	Fri Aug 24 15:30:31 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#Name of the application, e.g. displayed at login time
-VUE_APP_TITLE=Waterway Monitoring system
-
-#Backend URL
-VUE_APP_API_URL=/api/
-VUE_BACKEND_API_URL=http://backend.example.com:8088
-
-#URL of secondary logo
-VUE_APP_SECONDARY_LOGO_URL=
-
-#Path of vendored images is copied during a webpack build
-VUE_APP_VENDOR_IMG_PATH=
--- a/client/README.md	Fri Aug 24 15:30:31 2018 +0200
+++ b/client/README.md	Fri Aug 24 15:33:33 2018 +0200
@@ -7,14 +7,14 @@
 
     `yarn install`
 
-* Configuration via `.env`-file
-
-  **Example** given via `.env.sample`
+* Extend or overwrite configuration via `.env.local`-file
 
   ```
-  cp .env.sample .env
+  cp .env .env.local
   ````
 
+  Modify `.env.local` according to your needs.
+
 * Start Development servers
 
   * Javascript
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/components/Passwordfield.vue	Fri Aug 24 15:33:33 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="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", "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";
+    },
+    eyeIcon() {
+      return {
+        fa: true,
+        "fa-eye": !this.readablePassword,
+        "fa-eye-slash": this.readablePassword
+      };
+    }
+  }
+};
+</script>
--- a/client/src/components/Sidebar.vue	Fri Aug 24 15:30:31 2018 +0200
+++ b/client/src/components/Sidebar.vue	Fri Aug 24 15:33:33 2018 +0200
@@ -7,6 +7,8 @@
       <a class="nav-link" href="#">Link</a>
       <a class="nav-link disabled" href="#">Disabled</a>
       <div v-if="isSysAdmin">
+        <hr/>
+        <div class="text-muted">Administration</div>
         <router-link to="users">Users</router-link>
       </div>
     </nav>
--- a/client/src/components/Userdetail.vue	Fri Aug 24 15:30:31 2018 +0200
+++ b/client/src/components/Userdetail.vue	Fri Aug 24 15:33:33 2018 +0200
@@ -2,7 +2,7 @@
   <div class="userdetails shadown fadeIn animated">
     <div class="card">
       <div class="card-header shadow-sm text-white bg-info mb-3">
-          {{ currentUser.user }}
+          {{ this.cardHeader }}
         <span @click="closeDetailview" class="pull-right"><i class="fa fa-close"></i></span>
       </div>
       <div class="card-body">
@@ -10,7 +10,7 @@
           <div class="formfields">
             <div v-if="currentUser.isNew" class="form-group row">
               <label for="user">Username</label>
-              <input type="user" class="form-control form-control-sm" id="user" aria-describedby="userHelp" v-model="currentUser.user">
+              <input type="user" :placeholder="userNamePlaceholder" class="form-control form-control-sm" id="user" aria-describedby="userHelp" v-model="currentUser.user">
               <div v-show="errors.user" class="text-danger"><small><i class="fa fa-warning"></i> {{ errors.user }}</small></div>
             </div>
             <div class="form-group row">
@@ -37,14 +37,18 @@
               <div v-show="errors.role" class="text-danger"><small><i class="fa fa-warning"></i> {{ errors.role }}</small></div>
             </div>
             <div class="form-group row">
-              <label for="password">Password</label>
-              <input type="password" v-on:change="validatePassword" class="form-control form-control-sm" id="password" aria-describedby="passwordHelp" v-model="password">
-              <div v-show="errors.password" class="text-danger"><small><i class="fa fa-warning"></i> {{ errors.password }}</small></div>
+              <PasswordField @fieldchange="passwordChanged"
+                             :placeholder="passwordPlaceholder"
+                             :label="passwordLabel"
+                             :passworderrors="errors.password"
+              ></PasswordField>
             </div>
             <div class="form-group row">
-              <label for="passwordre">Retype Password</label>
-              <input type="password" v-on:change="validatePassword" class="form-control form-control-sm" id="passwordre" aria-describedby="passwordreHelp" v-model="passwordre">
-              <div v-show="errors.passwordre" class="text-danger"><small><i class="fa fa-warning"></i> {{ errors.passwordre }}</small></div>
+              <PasswordField @fieldchange="passwordReChanged"
+                             :placeholder="passwordRePlaceholder"
+                             :label="passwordReLabel"
+                             :passworderrors="errors.passwordre"
+              ></PasswordField>
             </div>
           </div>
           <div>
@@ -78,6 +82,7 @@
 <script>
 import { displayError } from "../lib/errors.js";
 import { mapGetters } from "vuex";
+import PasswordField from "../components/Passwordfield";
 
 const emptyErrormessages = () => {
   return {
@@ -113,8 +118,15 @@
 
 export default {
   name: "userdetail",
+  components: {
+    PasswordField
+  },
   data() {
     return {
+      passwordLabel: "Password",
+      passwordReLabel: "Repeat Password",
+      passwordPlaceholder: "password",
+      passwordRePlaceholder: "password again",
       password: "",
       passwordre: "",
       currentUser: {},
@@ -142,6 +154,14 @@
     }
   },
   computed: {
+    cardHeader() {
+      if (this.currentUser.isNew) return "N.N";
+      return this.currentUser.user;
+    },
+    userNamePlaceholder() {
+      if (this.currentUser.isNew) return "N.N";
+      return "";
+    },
     ...mapGetters("application", ["countries"]),
     user() {
       return this.$store.getters["usermanagement/currentUser"];
@@ -156,6 +176,14 @@
     }
   },
   methods: {
+    passwordChanged(value) {
+      this.password = value;
+      this.validatePassword();
+    },
+    passwordReChanged(value) {
+      this.passwordre = value;
+      this.validatePassword();
+    },
     clearErrors() {
       this.errors = emptyErrormessages();
     },
--- a/client/src/stores/usermanagement.js	Fri Aug 24 15:30:31 2018 +0200
+++ b/client/src/stores/usermanagement.js	Fri Aug 24 15:33:33 2018 +0200
@@ -2,7 +2,7 @@
 
 const newUser = () => {
   return {
-    user: "N.N",
+    user: "",
     email: "",
     country: null,
     role: null,
--- a/client/vue.config.js	Fri Aug 24 15:30:31 2018 +0200
+++ b/client/vue.config.js	Fri Aug 24 15:33:33 2018 +0200
@@ -21,6 +21,7 @@
         target: "http://localhost:5000",
         secure: false
       }
-    }
+    },
+    disableHostCheck: true
   }
 };
--- a/pkg/config/config.go	Fri Aug 24 15:30:31 2018 +0200
+++ b/pkg/config/config.go	Fri Aug 24 15:33:33 2018 +0200
@@ -129,9 +129,9 @@
 
 	str("mail-host", "localhost", "server to send mail with")
 	ui("mail-port", 465, "port of server to send mail with")
-	str("mail-user", "gemma", "user to send mail with")
+	str("mail-user", "gemma", "user to authenticate against mail-host. Leave empty for trying to send without auth.")
 	str("mail-password", "", "password of user to send mail with")
-	str("mail-from", "noreplay@localhost", "from line of mails")
+	str("mail-from", "noreply@localhost", "from line of mails")
 	str("mail-helo", "localhost", "name of server to send mail from.")
 
 	strSl("allowed-origins", allowedOrigins, "allow access for remote origins")