Validate application/json on server side

This commit is contained in:
Yukino Song
2025-05-28 18:01:48 +08:00
parent f3d2078b11
commit a3e0318794
3 changed files with 124 additions and 72 deletions

View File

@@ -421,8 +421,13 @@
requestOTP() {
if (this.editingHost) return;
fetch(`./api/otp?passphrase=${this.passphrase}${this.deviceName && `&deviceName=${this.deviceName}` || ''}`, {
credentials: 'include'
fetch("./api/otp", {
credentials: 'include',
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ passphrase: this.passphrase, deviceName: this.deviceName })
})
.then(resp => resp.json())
.then(resp => {