Small login fix and add urllib3 specification

master
Matthieu DUVAL 5 years ago
parent 88b0cef45c
commit f13daa3322

@ -17,7 +17,7 @@
}, },
"create_entry": { "create_entry": {
"default": "\n\nJust give your credentials" "default": "\n\nLogin succes ({auth_token})"
} }
} }
} }

@ -59,6 +59,7 @@ async def async_setup_entry(hass, entry):
password = config.get(CONF_EMAIL) or entry.data[CONF_EMAIL] password = config.get(CONF_EMAIL) or entry.data[CONF_EMAIL]
account = GeorideApi.get_authorisation_token(email, password) account = GeorideApi.get_authorisation_token(email, password)
context = GeorideContext( context = GeorideContext(
hass, hass,
email, email,

@ -41,8 +41,17 @@ class GeorideConfigFlow(config_entries.ConfigFlow):
_LOGGER.info("user email: %", str(user_input)) _LOGGER.info("user email: %", str(user_input))
if self._async_current_entries():
return self.async_abort(reason="one_instance_allowed")
if user_input is None:
return self.async_show_form(step_id='user', data_schema=vol.Schema({
vol.Required(CONF_EMAIL): vol.All(str, vol.Length(min=3)),
vol.Required(CONF_PASSWORD): vol.All(str)
}))
return self.async_create_entry( return self.async_create_entry(
title=user_input[CONF_EMAIL] + "machin", title=user_input,
data={ data={
CONF_EMAIL: user_input[CONF_EMAIL], CONF_EMAIL: user_input[CONF_EMAIL],
CONF_PASSWORD: user_input[CONF_PASSWORD] CONF_PASSWORD: user_input[CONF_PASSWORD]

@ -4,7 +4,8 @@
"config_flow": true, "config_flow": true,
"documentation": "https://git.tontontux.fr/mduval/GeorideHA", "documentation": "https://git.tontontux.fr/mduval/GeorideHA",
"requirements": [ "requirements": [
"georideapilib==0.1.0" "georideapilib==0.1.0",
"urllib3>=1.25.6"
], ],
"dependencies": [], "dependencies": [],
"codeowners": ["@ptimatth"] "codeowners": ["@ptimatth"]

Loading…
Cancel
Save