Example #1
0
def get_email(more=False, invalid=False):
    """Prompt for valid email address.

    :param bool more: explain why the email is strongly advisable, but how to
        skip it
    :param bool invalid: true if the user just typed something, but it wasn't
        a valid-looking email

    :returns: Email or ``None`` if cancelled by user.
    :rtype: str

    """
    msg = "Enter email address (used for urgent notices and lost key recovery)"
    if invalid:
        msg = "There seem to be problems with that address. " + msg
    if more:
        msg += ('\n\nIf you really want to skip this, you can run the client with '
                '--register-unsafely-without-email but make sure you backup your '
                'account key from /etc/letsencrypt/accounts\n\n')
    try:
        code, email = zope.component.getUtility(interfaces.IDisplay).input(msg)
    except errors.MissingCommandlineFlag:
        msg = ("You should register before running non-interactively, or provide --agree-tos"
               " and --email <email_address> flags")
        raise errors.MissingCommandlineFlag(msg)

    if code == display_util.OK:
        if le_util.safe_email(email):
            return email
        else:
            # TODO catch the server's ACME invalid email address error, and
            # make a similar call when that happens
            return get_email(more=True, invalid=(email != ""))
    else:
        return None
Example #2
0
def get_email(more=False, invalid=False):
    """Prompt for valid email address.

    :param bool more: explain why the email is strongly advisable, but how to
        skip it
    :param bool invalid: true if the user just typed something, but it wasn't
        a valid-looking email

    :returns: Email or ``None`` if cancelled by user.
    :rtype: str

    """
    msg = "Enter email address (used for urgent notices and lost key recovery)"
    if invalid:
        msg = "There seem to be problems with that address. " + msg
    if more:
        msg += (
            '\n\nIf you really want to skip this, you can run the client with '
            '--register-unsafely-without-email but make sure you backup your '
            'account key from /etc/letsencrypt/accounts\n\n')
    try:
        code, email = zope.component.getUtility(interfaces.IDisplay).input(msg)
    except errors.MissingCommandlineFlag:
        msg = (
            "You should register before running non-interactively, or provide --agree-tos"
            " and --email <email_address> flags")
        raise errors.MissingCommandlineFlag(msg)

    if code == display_util.OK:
        if le_util.safe_email(email):
            return email
        else:
            # TODO catch the server's ACME invalid email address error, and
            # make a similar call when that happens
            return get_email(more=True, invalid=(email != ""))
    else:
        return None
Example #3
0
 def _call(cls, addr):
     from certbot.le_util import safe_email
     return safe_email(addr)
Example #4
0
 def _call(cls, addr):
     from certbot.le_util import safe_email
     return safe_email(addr)