import re

from src.utils.exceptions import InvalidBody


def validate_user_body(body):
    validate_email(body["email"])
    validate_password(body["password"])

def validate_company_body(body):
    validate_email(body["email"])

def validate_password(password):
    if not password:
        raise InvalidBody("You must provide a password", status=400)


def validate_email(email):
    regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
    result = re.search(regex, email)
    if not result:
        raise InvalidBody("Email address is not valid", status=400)


ba94c9ada6d8259b8a0370f396028bdc1dd13ac3
<mask token>

<mask token>


def validate_user_body(body):
    validate_email(body['email'])
    validate_password(body['password'])


def validate_company_body(body):
    validate_email(body['email'])


<mask token>


def validate_email(email):
    regex = '^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$'
    result = re.search(regex, email)
    if not result:
        raise InvalidBody('Email address is not valid', status=400)

<mask token>


def validate_user_body(body):
    validate_email(body['email'])
    validate_password(body['password'])


def validate_company_body(body):
    validate_email(body['email'])


def validate_password(password):
    if not password:
        raise InvalidBody('You must provide a password', status=400)


def validate_email(email):
    regex = '^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$'
    result = re.search(regex, email)
    if not result:
        raise InvalidBody('Email address is not valid', status=400)

import re
from src.utils.exceptions import InvalidBody


def validate_user_body(body):
    validate_email(body['email'])
    validate_password(body['password'])


def validate_company_body(body):
    validate_email(body['email'])


def validate_password(password):
    if not password:
        raise InvalidBody('You must provide a password', status=400)


def validate_email(email):
    regex = '^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$'
    result = re.search(regex, email)
    if not result:
        raise InvalidBody('Email address is not valid', status=400)

import re

from src.utils.exceptions import InvalidBody


def validate_user_body(body):
    validate_email(body["email"])
    validate_password(body["password"])

def validate_company_body(body):
    validate_email(body["email"])

def validate_password(password):
    if not password:
        raise InvalidBody("You must provide a password", status=400)


def validate_email(email):
    regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$'
    result = re.search(regex, email)
    if not result:
        raise InvalidBody("Email address is not valid", status=400)

