def _create_session(account_main: AccountMain):
        account_session = AccountSession(account_main=account_main)
        account_session, err = AccountSessionDao().add(account_session)
        if err:
            return None, err

        account_main.auth_token = account_session.create_token()

        return account_main, None
    def auth_login(account_main: AccountMain):
        account_main.create_hash_password()
        account_main, err = AccountMainDao().get_by_email_and_hash_password(
            account_main)
        if err:
            return None, err

        if not account_main:
            return None, "Неверный email"

        account_session = AccountSession(account_main=account_main)
        account_session, err = AccountSessionDao().add(account_session)
        if err:
            return None, err

        account_main.auth_token = account_session.create_token()

        return account_main, None