Fix parent infinite dispense

This commit is contained in:
Alexandertp 2023-12-20 16:40:18 +01:00
parent 2feb822e8e
commit ea508bebc8
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ public class DispenserController : ControllerBase
if (user == null) {
return BadRequest("Invalid session token");
}
if (user.Dispenses == 0) {
if (user.Dispenses == 0 && !user.IsParent) {
Console.WriteLine("Poorfag");
return BadRequest("Not enough dispenses on account");
}

View File

@ -29,9 +29,9 @@ async function saveChild(child) {
<template v-if="userStore.state.userInfo">
<h2>Welcome back, {{ userStore.state.userInfo.username }}</h2>
<br>
<h3>You have {{ userStore.state.userInfo.dispenses }} dispenses remaining</h3>
<h3 v-show="!userStore.state.userInfo.isParent">You have {{ userStore.state.userInfo.dispenses }} dispenses remaining</h3>
<br>
<button @click="dispense" :disabled="userStore.state.userInfo.dispenses === 0">Dispense the m&m</button>
<button @click="dispense" :disabled="userStore.state.userInfo.dispenses === 0 && !userStore.state.userInfo.isParent">Dispense the m&m</button>
<br><br>
<h3>Your touch code is: {{ userStore.state.userInfo.touchCode }}</h3>
<p>Use this code to login on the dispenser</p>