Exemplo n.º 1
0
def updatepin(userid: int) -> Dict[str, Any]:
    pin = request.get_json()['pin']
    user = g.data.local.user.get_user(userid)
    # Make sure the user ID is valid
    if user is None:
        raise Exception('Cannot find user to update!')

    if not valid_pin(pin, 'card'):
        raise Exception('Invalid pin, must be exactly 4 digits!')

    # Update the user
    g.data.local.user.update_pin(userid, pin)

    return {}
Exemplo n.º 2
0
def updatepin() -> Dict[str, Any]:
    pin = request.get_json()['pin']
    user = g.data.local.user.get_user(g.userID)
    if user is None:
        raise Exception('Unable to find user to update!')

    if not valid_pin(pin, 'card'):
        raise Exception('Invalid PIN, must be exactly 4 digits!')

    # Update and save
    g.data.local.user.update_pin(g.userID, pin)

    # Return nothing
    return {}
Exemplo n.º 3
0
def updatepin(arcadeid: int) -> Dict[str, Any]:
    pin = request.get_json()['pin']

    # Make sure the arcade is valid
    arcade = g.data.local.machine.get_arcade(arcadeid)
    if arcade is None:
        raise Exception('Unable to find arcade to update!')
    if g.userID not in arcade.owners:
        raise Exception('You don\'t own this arcade, refusing to update!')

    if not valid_pin(pin, 'arcade'):
        raise Exception('Invalid PIN, must be exactly 8 digits!')

    # Update and save
    arcade.pin = pin
    g.data.local.machine.put_arcade(arcade)

    # Return nothing
    return {'pin': pin}