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) {
|
||||
document.body.classList.add('author')
|
||||
} else {
|
||||
// Check if access is authorized to root page
|
||||
// xBasic is to not have the authentication popup
|
||||
fetch('/', {headers: {'WWW-Authenticate': 'xBasic'}})
|
||||
.then(result => { if (result.status === 200) document.body.classList.add('author') })
|
||||
// Special URL which does not require authentication but returns browser's headers
|
||||
// thus we can deduce if user is authenticated
|
||||
fetch('/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
|
||||
|
Loading…
Reference in New Issue
Block a user