Somehow the ID of demo user changed. Use email of demo instead
This commit is contained in:
		
							parent
							
								
									096b98d22f
								
							
						
					
					
						commit
						bba8ae54d7
					
				| @ -30,15 +30,15 @@ router.get("/", route({}), async (req: Request, res: Response) => { | ||||
| }); | ||||
| 
 | ||||
| router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: Response) => { | ||||
| 	if (req.user_id === "992772978150273216") throw new HTTPError("Demo user, sorry", 400); | ||||
| 
 | ||||
| 	const body = req.body as UserModifySchema; | ||||
| 
 | ||||
| 	const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] }); | ||||
| 
 | ||||
| 	if (user.email == "demo@maddy.k.vu") throw new HTTPError("Demo user, sorry", 400); | ||||
| 
 | ||||
| 	if (body.avatar) body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string); | ||||
| 	if (body.banner) body.banner = await handleFile(`/banners/${req.user_id}`, body.banner as string); | ||||
| 
 | ||||
| 	const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] }); | ||||
| 
 | ||||
| 	if (body.password) { | ||||
| 		if (user.data?.hash) { | ||||
| 			const same_password = await bcrypt.compare(body.password, user.data.hash || ""); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Madeline
						Madeline