This should be fine actually
This commit is contained in:
@@ -38,13 +38,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.newPassword) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{ success: false, message: 'No new password provided' },
|
||||
400
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
!/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_\-+=]{8,}$/.test(
|
||||
|
||||
@@ -37,13 +37,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.newUsername) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{ success: false, message: 'No new username provided' },
|
||||
400
|
||||
)
|
||||
}
|
||||
|
||||
if (!/^[a-zA-Z0-9]{3,16}$/.test(body.newUsername)) {
|
||||
connection0.end()
|
||||
|
||||
@@ -28,26 +28,6 @@ export async function handler (context: Context) {
|
||||
const { connection: connection0, db: db0 } = dbInfo0
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.email || !body.verifyCode) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Email and verifyCode must be in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
if (body.verifyCode.length != 16) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Invalid verify code (codes can only be used once)'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
const ip = getClientIp(context)
|
||||
if (!ip) {
|
||||
connection0.end()
|
||||
|
||||
@@ -27,26 +27,6 @@ export async function handler (context: Context) {
|
||||
const { connection: connection0, db: db0 } = dbInfo0
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.email || !body.verifyCode) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Email and verifyCode must be in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
if (body.verifyCode.length != 16) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Invalid verify code (codes can only be used once)'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
const ip = getClientIp(context)
|
||||
if (!ip) {
|
||||
connection0.end()
|
||||
@@ -58,7 +38,6 @@ export async function handler (context: Context) {
|
||||
400
|
||||
)
|
||||
}
|
||||
const time = Math.floor(Date.now() / 1000)
|
||||
if (!(await verifyTurstileOrVerifyCode(body.token, body.verifyCode, ip, db0)))
|
||||
return jsonResponse(
|
||||
{
|
||||
|
||||
@@ -21,17 +21,6 @@ export async function handler (context: Context) {
|
||||
const { connection: connection0, db: db0 } = dbInfo0
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.username || !body.password) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Username and password must be in POST data',
|
||||
data: null
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
|
||||
const user = await db0
|
||||
.select({
|
||||
|
||||
@@ -31,28 +31,6 @@ export async function handler (context: Context) {
|
||||
const { connection: connection1, db: db1 } = dbInfo1
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.username || !body.password || !body.email || !body.verifyCode) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Username, password, email and verifyCode must be in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
if (body.verifyCode.length != 16) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Invalid verify code (codes can only be used once)'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
const ip = getClientIp(context)
|
||||
if (!ip) {
|
||||
connection0.end()
|
||||
|
||||
@@ -27,16 +27,6 @@ export async function handler (context: Context) {
|
||||
const { connection: connection0, db: db0 } = dbInfo0
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.token || !body.code || !body.password) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Token, code and password must be in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
if (body.code.length != 64) {
|
||||
connection0.end()
|
||||
return jsonResponse(
|
||||
|
||||
@@ -39,14 +39,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.saveData) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{ success: false, message: 'No valid save data provided' },
|
||||
400
|
||||
)
|
||||
}
|
||||
|
||||
let userSaveData: any = {}
|
||||
try {
|
||||
|
||||
@@ -73,17 +73,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.verifyCode && !body.token) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'verifyCode or token must be provided in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
const price = parseInt(body.price, 10)
|
||||
if (isNaN(price)) {
|
||||
connection0.end()
|
||||
|
||||
@@ -41,14 +41,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.content) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{ success: false, message: 'No valid content provided', data: null },
|
||||
400
|
||||
)
|
||||
}
|
||||
|
||||
await db1
|
||||
.insert(berryDashUserPosts)
|
||||
|
||||
@@ -53,17 +53,6 @@ export async function handler (context: Context) {
|
||||
const userId = authResult.id
|
||||
|
||||
const body = context.body as Body
|
||||
if (!body.token || !body.content) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
return jsonResponse(
|
||||
{
|
||||
success: false,
|
||||
message: 'Token and content must be in POST data'
|
||||
},
|
||||
400
|
||||
)
|
||||
}
|
||||
if (body.content.length > 72) {
|
||||
connection0.end()
|
||||
connection1.end()
|
||||
|
||||
Reference in New Issue
Block a user