forked from ppfun/pixelplanet
check for login on auth routes
This commit is contained in:
parent
3ebb954c59
commit
f8552b0ea6
|
@ -35,7 +35,7 @@ export default async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { user, lang } = req;
|
const { user, lang } = req;
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: [t`You are not authenticated.`],
|
errors: [t`You are not authenticated.`],
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default async (req: Request, res: Response) => {
|
||||||
const { name } = req.body;
|
const { name } = req.body;
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
|
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: ['You are not authenticated.'],
|
errors: ['You are not authenticated.'],
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default async (req: Request, res: Response) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: [t`You are not authenticated.`],
|
errors: [t`You are not authenticated.`],
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default async (req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: [t`You are not authenticated.`],
|
errors: [t`You are not authenticated.`],
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type { Request, Response } from 'express';
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
const { t } = req.ttag;
|
const { t } = req.ttag;
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: [t`You are not even logged in.`],
|
errors: [t`You are not even logged in.`],
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { getHostFromRequest } from '../../../utils/ip';
|
||||||
|
|
||||||
export default async (req: Request, res: Response) => {
|
export default async (req: Request, res: Response) => {
|
||||||
const { user, lang } = req;
|
const { user, lang } = req;
|
||||||
if (!user) {
|
if (!user || !user.regUser) {
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({
|
res.json({
|
||||||
errors: ['You are not authenticated.'],
|
errors: ['You are not authenticated.'],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user