comparison client/src/components/Userdetail.vue @ 397:b5555bf6d45c

fix: Clear errors on user switch When user switched selection of which accounts to edit, validation errors werent cleared.
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 14 Aug 2018 09:59:55 +0200
parents c57b952c60be
children cb233a5a2ecd
comparison
equal deleted inserted replaced
396:c6290776c65c 397:b5555bf6d45c
81 box-shadow: $basic-shadow-light !important; 81 box-shadow: $basic-shadow-light !important;
82 } 82 }
83 </style> 83 </style>
84 <script> 84 <script>
85 import app from "../main"; 85 import app from "../main";
86
87 const clearedErrors = () => {
88 return {
89 email: "",
90 country: "",
91 role: "",
92 password: "",
93 passwordre: ""
94 };
95 };
86 96
87 const isEmailValid = email => { 97 const isEmailValid = email => {
88 /* cf. types.go */ 98 /* cf. types.go */
89 // eslint-disable-next-line 99 // eslint-disable-next-line
90 return /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test( 100 return /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(
125 }, 135 },
126 watch: { 136 watch: {
127 user() { 137 user() {
128 this.currentUser = { ...this.user }; 138 this.currentUser = { ...this.user };
129 this.path = this.user.name; 139 this.path = this.user.name;
140 this.errors = clearedErrors();
130 } 141 }
131 }, 142 },
132 computed: { 143 computed: {
133 user() { 144 user() {
134 return this.$store.getters["usermanagement/currentUser"]; 145 return this.$store.getters["usermanagement/currentUser"];