From cf1b40542c41b3c78e83650e4e73e596c85ff160 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Tue, 26 Feb 2019 02:46:36 +0000 Subject: [account] Fix for the changePassword method User upadate changes didn't hashed the new password correctly changePassword from promises reworked to async / await (much cleaner) Check weather the usertable is empty is now a get request and not mixed in the post request --- webapp/src/components/AccountModule.vue | 2 +- webapp/src/components/StartPageSetup.vue | 4 +++- webapp/src/components/UserModuleEdit.vue | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'webapp') diff --git a/webapp/src/components/AccountModule.vue b/webapp/src/components/AccountModule.vue index 013f916..f24da2c 100644 --- a/webapp/src/components/AccountModule.vue +++ b/webapp/src/components/AccountModule.vue @@ -315,7 +315,7 @@ export default { }, submitPassword () { if (this.$refs.passwordForm.validate()) { - this.$http.post('/api/users/' + this.user.id + '/password', { passwordCurrent: this.passwordCurrent, passwordNew: this.passwordNew }).then(response => { + this.$http.post('/api/users/' + this.user.id + '/password', { passwordCurrent: this.passwordCurrent, password: this.passwordNew }).then(response => { this.cancelEditPassword() this.$snackbar({ color: 'success', text: this.$t('passwordChanged') }) }).catch(error => { diff --git a/webapp/src/components/StartPageSetup.vue b/webapp/src/components/StartPageSetup.vue index 8d41f81..36ad648 100644 --- a/webapp/src/components/StartPageSetup.vue +++ b/webapp/src/components/StartPageSetup.vue @@ -72,12 +72,14 @@ export default { }, beforeRouteEnter (to, from, next) { // If there are already users in the db, redirect to the login page. - Vue.prototype.$http.post('/api/authentication/setup').then(result => { + Vue.prototype.$http.get('/api/authentication/setup').then(result => { if (result.data.status !== 'SUCCESS') { next({ name: 'login' }) } else { next() } + }).catch(() => { + next({ name: 'login' }) }) } } diff --git a/webapp/src/components/UserModuleEdit.vue b/webapp/src/components/UserModuleEdit.vue index 924a109..e989c11 100644 --- a/webapp/src/components/UserModuleEdit.vue +++ b/webapp/src/components/UserModuleEdit.vue @@ -3,12 +3,14 @@ "en": { "titleExisting": "Edit user", "titleNew": "Create user", - "userCreated": "User was successfully created." + "userCreated": "User was successfully created.", + "userUpdated": "User was successfully updated." }, "de": { "titleExisting": "Benutzer bearbeiten", "titleNew": "Benutzer erstellen", - "userCreated": "Benutzer wurde erfolgreich erstellt." + "userCreated": "Benutzer wurde erfolgreich erstellt.", + "userUpdated": "Benutzer wurde erfolgreich aktualisiert." } } @@ -67,7 +69,7 @@ export default { }).then(response => { this.$store.dispatch('users/loadData') this.setDialog({ show: false }) - this.$snackbar({ color: 'success', text: this.$t('userCreated') }) + this.$snackbar({ color: 'success', text: this.dialog.info.id ? this.$t('userUpdated') : this.$t('userCreated') }) }).catch(error => { if (error.response.data.status === 'USER_ALREADY_EXISTS') { this.$refs.editComponent.setUsernameTakenError() -- cgit v1.2.3-55-g7522