Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better validation of data #1

Open
github-actions bot opened this issue Jul 3, 2021 · 0 comments
Open

better validation of data #1

github-actions bot opened this issue Jul 3, 2021 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jul 3, 2021

better validation of data

https://github.com/jcgoette/our_club_login_homeassistant/blob/110f893a628862d5dd75483e3e981d102ca6c353/custom_components/our_club_login/config_flow.py#L9

import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME

from .const import ATTR_TITLE, DOMAIN


# TODO: better validation of data
# TODO: translations
class OurClubLoginConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
    async def async_step_user(self, user_input):
        if user_input is not None:
            return self.async_create_entry(title=ATTR_TITLE, data=user_input)

        return self.async_show_form(
            step_id="user",
            data_schema=vol.Schema(
                {
                    vol.Required(CONF_ID): cv.string,
                    vol.Required(CONF_USERNAME): cv.string,
                    vol.Required(CONF_PASSWORD): cv.string,
                }
            ),
        )

bd9ca5743b07870500bdf6b2d8d0911e2021eb00

@github-actions github-actions bot added the todo label Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants