chiefwigms / picobrew_pico

MIT License
149 stars 63 forks source link

Make device alias and uid required when add devices #244

Closed cgalpin closed 3 years ago

cgalpin commented 3 years ago

Without this check, empty values can be written to config.yaml that cannot be deleted. They also look odd without a name :)

chiefwigms commented 3 years ago

thank you good sir!

cgalpin commented 3 years ago

Actually, my apologies. I committed the version I had offered, not the simpler one. If you'd prefer, I can do

        # both uid and alias are required
        if len(uid) == 0 or len(alias) == 0:
            error = f'Both Machine/Product ID and Alias are required'
            current_app.logger.error(error)
            return render_template_with_defaults('devices.html', error=error,
                config=server_config(), active_sessions=active_sessions)
chiefwigms commented 3 years ago

It's all good.

tmack8001 commented 3 years ago

Also since we are using the id as a HTML id we should make sure to trim any user provided input. I selected a UID on my mobile device and didn't double check it before aliasing the device via the UI and got " xyz" which now breaks the UI 😜 . All this non-sense to support those that can't understand a network share 🤦‍♂️

https://github.com/chiefwigms/picobrew_pico/pull/245

cgalpin commented 3 years ago

I think you have to make it easy to use. Not everyone is computer savvy, or even have computers. Kids these days just use phones and tablets and seem to be fine with it.

I'm guessing like me, you guys are close to yelling get off my lawn! 😉

tmack8001 commented 3 years ago

If people find this too hard they can go with "the other option" and buy a much more expensive M$ computer 🤣, or I know plenty of folks that will take a "trash" destined unit for "repurposing"