mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-15 13:51:35 +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
|
||||
},
|
||||
checkAuth() {
|
||||
const headers = {}
|
||||
|
||||
const token = localStorage.getItem('token')
|
||||
if (!token) return false
|
||||
if (token) {
|
||||
headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
|
||||
this.processing = true
|
||||
|
||||
return this.$axios
|
||||
.$post('/api/authorize', null, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
})
|
||||
.$post('/api/authorize', null, { headers })
|
||||
.then((res) => {
|
||||
this.setUser(res)
|
||||
this.processing = false
|
||||
|
|
@ -214,11 +214,14 @@ export default {
|
|||
}
|
||||
},
|
||||
async mounted() {
|
||||
if (localStorage.getItem('token')) {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue