mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 07:41:02 +08:00
Fix the var that is causing platforms to not send correctly & fix
check user info everytime after you file for a change.
This commit is contained in:
parent
f1324ae0e4
commit
68d1c8f018
@ -141,7 +141,9 @@ const submitChangeAction = async (action: string) => {
|
|||||||
const response = await req.json();
|
const response = await req.json();
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
console.error("Error updating user data:", response.error);
|
console.error("Error updating user data:", response.error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
await validateUserInfo();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to submit change:", error);
|
console.error("Failed to submit change:", error);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
if (body.jsonValue.length === 0) {
|
if (body.jsonValue.length === 0) {
|
||||||
const clearBadDataRegex = /[@-_.+a-zA-Z0-9]{2,}/;
|
const clearBadDataRegex = /[@-_.+a-zA-Z0-9]{2,}/;
|
||||||
// Use Static values for now.
|
// Use Static values for now.
|
||||||
const requestChange = body.action;
|
const requestChange = body.action || "";
|
||||||
const apiKeyqq = body.value.match(clearBadDataRegex);
|
const apiKeyqq = body.value.match(clearBadDataRegex);
|
||||||
const allowedColumns = ["firstname", "email"];
|
const allowedColumns = ["firstname", "email"];
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
return {
|
return {
|
||||||
error: "ERR_NOT_ALLOWED",
|
error: "ERR_NOT_ALLOWED",
|
||||||
};
|
};
|
||||||
} else if (requestChange === "name") {
|
} else if (requestChange === "firstname") {
|
||||||
const sqlC = await sql`
|
const sqlC = await sql`
|
||||||
UPDATE users SET firstname = ${apiKeyqq[0]}
|
UPDATE users SET firstname = ${apiKeyqq[0]}
|
||||||
WHERE username = ${token.user}`;
|
WHERE username = ${token.user}`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user