diff --git a/src/routes/api/auth/change_mail.js b/src/routes/api/auth/change_mail.js index 4d4d6a2b..1f4d2dd4 100644 --- a/src/routes/api/auth/change_mail.js +++ b/src/routes/api/auth/change_mail.js @@ -35,7 +35,7 @@ export default async (req: Request, res: Response) => { } const { user, lang } = req; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: [t`You are not authenticated.`], diff --git a/src/routes/api/auth/change_name.js b/src/routes/api/auth/change_name.js index 3661e9f0..1c394edf 100644 --- a/src/routes/api/auth/change_name.js +++ b/src/routes/api/auth/change_name.js @@ -26,7 +26,7 @@ export default async (req: Request, res: Response) => { const { name } = req.body; const { user } = req; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: ['You are not authenticated.'], diff --git a/src/routes/api/auth/change_passwd.js b/src/routes/api/auth/change_passwd.js index 32b9beeb..f60840c9 100644 --- a/src/routes/api/auth/change_passwd.js +++ b/src/routes/api/auth/change_passwd.js @@ -31,7 +31,7 @@ export default async (req: Request, res: Response) => { } const { user } = req; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: [t`You are not authenticated.`], diff --git a/src/routes/api/auth/delete_account.js b/src/routes/api/auth/delete_account.js index 9b3fc1ef..0ff475bd 100644 --- a/src/routes/api/auth/delete_account.js +++ b/src/routes/api/auth/delete_account.js @@ -28,7 +28,7 @@ export default async (req, res) => { } const { user } = req; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: [t`You are not authenticated.`], diff --git a/src/routes/api/auth/logout.js b/src/routes/api/auth/logout.js index 412f38ed..ad22c844 100644 --- a/src/routes/api/auth/logout.js +++ b/src/routes/api/auth/logout.js @@ -7,7 +7,7 @@ import type { Request, Response } from 'express'; export default async (req: Request, res: Response) => { const { user } = req; const { t } = req.ttag; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: [t`You are not even logged in.`], diff --git a/src/routes/api/auth/resend_verify.js b/src/routes/api/auth/resend_verify.js index 71f05179..2a3ec9ac 100644 --- a/src/routes/api/auth/resend_verify.js +++ b/src/routes/api/auth/resend_verify.js @@ -11,7 +11,7 @@ import { getHostFromRequest } from '../../../utils/ip'; export default async (req: Request, res: Response) => { const { user, lang } = req; - if (!user) { + if (!user || !user.regUser) { res.status(401); res.json({ errors: ['You are not authenticated.'],