summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJannik Schönartz2019-03-04 01:14:38 +0100
committerJannik Schönartz2019-03-04 01:14:38 +0100
commit6471511909de79c1f3739ba9d6a5b45b7eb1fadb (patch)
treeb0702eae88cea3ce8fff89f1fa2f91849e79e1ee /webapp
parent[webapp] add option to disable all animations (diff)
downloadbas-6471511909de79c1f3739ba9d6a5b45b7eb1fadb.tar.gz
bas-6471511909de79c1f3739ba9d6a5b45b7eb1fadb.tar.xz
bas-6471511909de79c1f3739ba9d6a5b45b7eb1fadb.zip
[authentication] Restructure api to match our new error code standard
Moved most of the res.send from the lib to the api Fixed frontend to match the new api
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/components/AccountModule.vue2
-rw-r--r--webapp/src/components/StartPageLogin.vue8
-rw-r--r--webapp/src/components/StartPageSetup.vue2
-rw-r--r--webapp/src/components/UserModuleDelete.vue6
-rw-r--r--webapp/src/components/UserModuleEdit.vue2
-rw-r--r--webapp/src/main.js2
6 files changed, 14 insertions, 8 deletions
diff --git a/webapp/src/components/AccountModule.vue b/webapp/src/components/AccountModule.vue
index 11395cb..9d22715 100644
--- a/webapp/src/components/AccountModule.vue
+++ b/webapp/src/components/AccountModule.vue
@@ -317,7 +317,7 @@ export default {
this.cancelEditPassword()
this.$snackbar({ color: 'success', text: this.$t('passwordChanged') })
}).catch(error => {
- if (error.response.data.status === 'PASSWORD_INVALID') {
+ if (error.response.data.error === 'PASSWORD_INVALID') {
this.invalidPasswordError = true
this.passwordNew = ''
this.passwordConfirm = ''
diff --git a/webapp/src/components/StartPageLogin.vue b/webapp/src/components/StartPageLogin.vue
index 87d4054..3e4b5b8 100644
--- a/webapp/src/components/StartPageLogin.vue
+++ b/webapp/src/components/StartPageLogin.vue
@@ -75,7 +75,7 @@ export default {
},
login () {
if (this.$refs.form.validate()) {
- this.$http.post('/api/authentication/login', { username: this.username, password: this.password })
+ this.$http.post('/api/authentication/cookies', { username: this.username, password: this.password })
.then(response => {
const nextRoute = this.$store.state.loginRedirect
if (nextRoute) this.$router.replace(nextRoute)
@@ -83,12 +83,12 @@ export default {
this.$socket.open()
})
.catch(error => {
- if (error.response.data.status === 'USER_NOTFOUND') {
+ if (error.response.data.error === 'USER_NOTFOUND') {
this.usernameError = true
- } else if (error.response.data.status === 'PASSWORD_INVALID') {
+ } else if (error.response.data.error === 'PASSWORD_INVALID') {
this.passwordError = true
} else {
- this.$snackbar({ color: 'error', text: error.response.data.error_message })
+ this.$snackbar({ color: 'error', text: error.response.data.message })
}
this.$refs.form.validate()
})
diff --git a/webapp/src/components/StartPageSetup.vue b/webapp/src/components/StartPageSetup.vue
index 1bde01c..0d111bc 100644
--- a/webapp/src/components/StartPageSetup.vue
+++ b/webapp/src/components/StartPageSetup.vue
@@ -67,7 +67,7 @@ export default {
this.$snackbar({ color: 'success', text: this.$t('rootCreated'), timeout: 15000 })
this.$router.replace({ name: 'login' })
}).catch(error => {
- this.$snackbar({ color: 'error', text: error.response.data.error_message, timeout: 15000 })
+ this.$snackbar({ color: 'error', text: error.response.data.message, timeout: 15000 })
})
}
}
diff --git a/webapp/src/components/UserModuleDelete.vue b/webapp/src/components/UserModuleDelete.vue
index 1487be7..c0c54e1 100644
--- a/webapp/src/components/UserModuleDelete.vue
+++ b/webapp/src/components/UserModuleDelete.vue
@@ -55,6 +55,12 @@ export default {
await this.$http.post('/api/users/?delete', {
ids: this.dialog.info.selected.map(x => x.id)
})
+ if (this.doIDeleteMyself) {
+ this.$http.post('/api/authentication/logout').then(response => {
+ this.$router.push('/login')
+ this.$socket.close()
+ })
+ }
this.$store.dispatch('users/loadData')
this.setDialog({ show: false })
}
diff --git a/webapp/src/components/UserModuleEdit.vue b/webapp/src/components/UserModuleEdit.vue
index e4f3cb0..e134a7e 100644
--- a/webapp/src/components/UserModuleEdit.vue
+++ b/webapp/src/components/UserModuleEdit.vue
@@ -74,7 +74,7 @@ export default {
this.setDialog({ show: false })
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') {
+ if (error.response.data.error === 'USER_ALREADY_EXISTS') {
this.$refs.editComponent.setUsernameTakenError()
}
})
diff --git a/webapp/src/main.js b/webapp/src/main.js
index 70afb40..9604fd1 100644
--- a/webapp/src/main.js
+++ b/webapp/src/main.js
@@ -60,7 +60,7 @@ Vue.use(VueCodemirror, {
Vue.use(VueTouch)
axios.interceptors.response.use(null, error => {
- if (error && error.response.status === 401) {
+ if (error && error.response.error === 401) {
axios.post('/api/authentication/logout').then(response => {
router.push('/login')
socket.close()