mirror of
https://github.com/renorris/openfsd
synced 2026-04-09 01:15:34 +08:00
Changes:
- Implement bootstrapping library for managing several concurrent internal services
- Refactor concurrency model for connections/logical clients and their associated I/O
- Refactor server context singleton
- Refactor error handling
- Most errors are now gracefully sent to the FSD client directly encoded as an $ER packet,
enhancing visibility and debugging
- Most errors are now rightfully treated as non-fatal
- Refactor package/dependency graph
- Refactor calling conventions/interfaces for many packages
- Refactor database package
- Refactor post office
Features:
- Add VATSIM-esque HTTP/JSON "data feed"
- Add ephemeral in-memory database option
- Add user management REST API
- Add improved web interface
- Add MySQL support (drop SQLite support)
27 lines
716 B
JavaScript
27 lines
716 B
JavaScript
async function handleVerifyTOTPSubmit(ev) {
|
|
ev.preventDefault()
|
|
|
|
const totp = $('#totp').val()
|
|
|
|
const res = await fetch("/api/v1/auth/verifytotp", {
|
|
body: JSON.stringify({
|
|
code: parseInt(totp),
|
|
}),
|
|
cache: "no-cache",
|
|
method: "POST",
|
|
credentials: "include",
|
|
})
|
|
|
|
if (res.status !== 200) {
|
|
const msg = res.status === 401 ? 'incorrect 2FA code' : `HTTP ${res.status} ${res.statusText}`
|
|
setAlert('alert', `Error: ${msg}`, 'danger')
|
|
return
|
|
}
|
|
|
|
const resPayload = await res.json()
|
|
|
|
localStorage.setItem("token", resPayload.token)
|
|
window.location.replace('/dashboard')
|
|
}
|
|
|
|
$('#form').submit(handleVerifyTOTPSubmit) |