mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-15 05:41:34 +00:00
allow login without token
if our proxy sends proxy auth headers, lets still try to log in even though we have no bearer token.
This commit is contained in:
parent
3f7ba82e6a
commit
a85ae7467c
1 changed files with 14 additions and 11 deletions
|
|
@ -170,17 +170,17 @@ export default {
|
||||||
this.processing = false
|
this.processing = false
|
||||||
},
|
},
|
||||||
checkAuth() {
|
checkAuth() {
|
||||||
|
const headers = {}
|
||||||
|
|
||||||
const token = localStorage.getItem('token')
|
const token = localStorage.getItem('token')
|
||||||
if (!token) return false
|
if (token) {
|
||||||
|
headers.Authorization = `Bearer ${token}`
|
||||||
|
}
|
||||||
|
|
||||||
this.processing = true
|
this.processing = true
|
||||||
|
|
||||||
return this.$axios
|
return this.$axios
|
||||||
.$post('/api/authorize', null, {
|
.$post('/api/authorize', null, { headers })
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${token}`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setUser(res)
|
this.setUser(res)
|
||||||
this.processing = false
|
this.processing = false
|
||||||
|
|
@ -214,11 +214,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
if (localStorage.getItem('token')) {
|
|
||||||
var userfound = await this.checkAuth()
|
var userfound = await this.checkAuth()
|
||||||
if (userfound) return // if valid user no need to check status
|
|
||||||
}
|
// if valid user no need to check status
|
||||||
|
if (userfound) {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
this.checkStatus()
|
this.checkStatus()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue