Check if user is authenticated
This commit is contained in:
parent
62640cf60d
commit
e2496cf17d
@ -12,10 +12,10 @@ if (topSection) document.body.classList.add(topSection)
|
|||||||
if ('pages' === topSection) {
|
if ('pages' === topSection) {
|
||||||
document.body.classList.add('author')
|
document.body.classList.add('author')
|
||||||
} else {
|
} else {
|
||||||
// Check if access is authorized to root page
|
// Special URL which does not require authentication but returns browser's headers
|
||||||
// xBasic is to not have the authentication popup
|
// thus we can deduce if user is authenticated
|
||||||
fetch('/', {headers: {'WWW-Authenticate': 'xBasic'}})
|
fetch('/author')
|
||||||
.then(result => { if (result.status === 200) document.body.classList.add('author') })
|
.then(result => { if (result.headers.get('authorization')) document.body.classList.add('author') })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup a "property" attribute, to send to the backend for insertion/update/deletion
|
// Setup a "property" attribute, to send to the backend for insertion/update/deletion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user