mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-18 08:38:33 +02:00
Added 2FA with U2F keys.
This commit is contained in:
parent
47fa8b04e5
commit
069293a843
18 changed files with 512 additions and 157 deletions
|
@ -495,6 +495,29 @@ $(document).on("ajaxUI:start ajaxUI:reload", function() {
|
|||
});
|
||||
});
|
||||
|
||||
//Register U2F on page reload too...
|
||||
$(document).on("ajaxUI:reload", function() {
|
||||
//@ts-ignore
|
||||
window.u2fauth.ready(function () {
|
||||
const form = document.getElementById('u2fForm')
|
||||
if (!form) {
|
||||
return
|
||||
}
|
||||
const type = form.dataset.action
|
||||
|
||||
if (type === 'auth') {
|
||||
//@ts-ignore
|
||||
u2fauth.authenticate()
|
||||
} else if (type === 'reg' && form.addEventListener) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
event.preventDefault()
|
||||
//@ts-ignore
|
||||
u2fauth.register()
|
||||
}, false)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
//Need for proper body padding, with every navbar height
|
||||
$(window).resize(function () {
|
||||
let height : number = $('#navbar').height() + 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue