[core] Check password length

This commit is contained in:
hagi 2020-07-16 00:19:23 +02:00 committed by dl6tom
parent 277eb77047
commit 1c45c75e0f

View file

@ -81,6 +81,11 @@ async def admin_register(values: BodyAdmin):
register_token = to_token(**values.__dict__)
logger.debug(f'register_token={register_token}')
# TODO implement check to see if email already is in database
if len(values.password) < 8:
logger.info('Password is too short')
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST, detail='Password is too short'
)
try:
email.send_email(
to=values.email,