* fix rate password

* convert int
This commit is contained in:
Pascal Vizeli 2018-02-18 12:18:11 +01:00 committed by GitHub
parent b4d5aeb5d0
commit 699fcdafba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,8 @@ def password_for_validating(password):
for _ in range(100):
password = hashlib.sha256(password.encode()).hexdigest()
try:
return sum(map(int, RE_DIGITS.findall(password)))
except ValueError:
return int(str(sum(map(int, RE_DIGITS.findall(password))))[0])
except (ValueError, IndexError):
return 0

View File

@ -29,7 +29,8 @@ SCHEMA_SNAPSHOT = vol.Schema({
vol.Required(ATTR_TYPE): vol.In([SNAPSHOT_FULL, SNAPSHOT_PARTIAL]),
vol.Required(ATTR_NAME): vol.Coerce(str),
vol.Required(ATTR_DATE): vol.Coerce(str),
vol.Inclusive(ATTR_PROTECTED, 'encrypted'): vol.Coerce(int),
vol.Inclusive(ATTR_PROTECTED, 'encrypted'):
vol.All(vol.Coerce(int), vol.Length(1)),
vol.Inclusive(ATTR_CRYPTO, 'encrypted'): CRYPTO_AES128,
vol.Optional(ATTR_HOMEASSISTANT, default=dict): vol.Schema({
vol.Optional(ATTR_VERSION): vol.Coerce(str),