comparison client/src/views/Login.vue @ 545:9d999d29c642

fix: Console.log statement removed Console.log statement removed. Improved readability.
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 31 Aug 2018 11:03:22 +0200
parents ee86ab038a7e
children b91791664554
comparison
equal deleted inserted replaced
544:9b2218a6c6ae 545:9d999d29c642
89 </style> 89 </style>
90 90
91 <script> 91 <script>
92 import { mapGetters } from "vuex"; 92 import { mapGetters } from "vuex";
93 import { HTTP } from "../lib/http"; 93 import { HTTP } from "../lib/http";
94 import { displayError } from "../lib/errors.js";
94 95
95 export default { 96 export default {
96 name: "login", 97 name: "login",
97 data() { 98 data() {
98 return { 99 return {
166 this.loginFailed = true; 167 this.loginFailed = true;
167 this.submitted = false; 168 this.submitted = false;
168 }); 169 });
169 }, 170 },
170 showPassword() { 171 showPassword() {
171 // disable button when in reset mode 172 // disallowing toggle when in reset mode
172 if (!this.showPasswordReset) { 173 if (this.showPasswordReset) return;
173 this.readablePassword = !this.readablePassword; 174 this.readablePassword = !this.readablePassword;
174 }
175 }, 175 },
176 togglePasswordReset() { 176 togglePasswordReset() {
177 this.passwordJustResetted = false; 177 this.passwordJustResetted = false;
178 this.showPasswordReset = !this.showPasswordReset; 178 this.showPasswordReset = !this.showPasswordReset;
179 this.loginFailed = false; 179 this.loginFailed = false;
180 }, 180 },
181 resetPassword() { 181 resetPassword() {
182 if (this.user) { 182 if (this.user) {
183 HTTP.post("/users/passwordreset", { user: this.user }).catch(error => { 183 HTTP.post("/users/passwordreset", { user: this.user }).catch(error => {
184 console.log("backend problem", error); 184 const { status, data } = error.response;
185 displayError({
186 title: "Backend Error",
187 message: `${status}: ${data.message}`
188 });
185 }); 189 });
186 this.togglePasswordReset(); 190 this.togglePasswordReset();
187 this.passwordJustResetted = true; 191 this.passwordJustResetted = true;
188 } 192 }
189 } 193 }