3
گas4 @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm
Z
dd
lmZ ddlm
Z
ddlmZ dd
lmZ ddlmZ dd
lmZ ddlmZ dd
lmZ ejeZdAeeedddZeej e ej dddZdBee e e ee dddZ dCe ej! e e ee dddZ"ee ee ddd Z#ee ee d!d"d#Z$dDee e e eeee f d$d%d&Z%dEeee d(d)d*Z&e
e ddd+d,Z'e
e dd-d.d/Z(edd0d1d2Z)ee*eedd3d4d5Z+e
e edd6d7Z,dFed8eeef f eegef ee e eeeef d9d:d;Z-eegef eeeeef d<d=d>Z.eegef eeeeef d<d?d@Z/dS )Gz+Contains UI methods for LE user operations. N)indent)Any)Callable)Iterable)List)Optional)Sequence)Tuple)errors)
interfaces)util)account)osFT)invalidoptionalreturnc C s d}d}d}|r(| r"||7 }d}q,d}nd}xy"t j| r@|| n|dd\}}W n$ tjk
rt d}tj|Y nX |t jkr|rtjdtjd tj|r|S |r|| }d}t|} q.W d
S )aJ Prompt for valid email address.
:param bool invalid: True if an invalid address was provided by the user
:param bool optional: True if the user can use
--register-unsafely-without-email to avoid providing an e-mail
:returns: e-mail address
:rtype: str
:raises errors.Error: if the user cancels
z-There seem to be problems with that address. zCEnter email address (used for urgent renewal and security notices)
a
If you really want to skip this, you can run the client with --register-unsafely-without-email but you will then be unable to receive notice about impending expiration or revocation of your certificates or problems with your Certbot installation that will lead to failure to renew.
FT)force_interactivezoYou should register before running non-interactively, or provide --agree-tos and --email flags.zHAn e-mail address or --register-unsafely-without-email must be provided.z#An e-mail address must be provided.N) display_util
input_textr
ZMissingCommandlineFlagOKErrorr Z
safe_emailbool)r r Zinvalid_prefixmsgZunsafe_suggestionZsuggest_unsafecodeZemail r /usr/lib/python3.6/ops.py get_email s6
r )accountsr c C s8 dd | D }t jd|dd\}}|t jkr4| | S dS )zChoose an account.
:param list accounts: Containing at least one
:class:`~certbot._internal.account.Account`
c S s g | ]
}|j qS r )Zslug).0Zaccr r r
U s z"choose_account..zPlease choose an accountT)r N)r Zmenur )r Zlabelsr indexr r r choose_accountM s
r! )valuesquestionr c C s2 t j|r|nd| dd\}}|t jkr.|r.|S g S )a Display screen to let user pick one or multiple values from the provided
list.
:param list values: Values to select from
:param str question: Question to ask to user while choosing values
:returns: List of selected values
:rtype: list
T)tagsr )r checklistr )r" r# r itemsr r r
choose_values] s
r( ) installerr# r c C sZ | dkrt jd t S t| j }t|}|s6t S t||\}}|tjkrV|rV|S g S )aQ Display screen to select domains to validate.
:param installer: An installer object
:type installer: :class:`certbot.interfaces.Installer`
:param `str` question: Overriding default question to ask the user if asked
to choose from domain names.
:returns: List of selected names
:rtype: `list` of `str`
Nz$No installer, picking names manually) loggerdebug_choose_names_manuallylistZ
get_all_namesget_valid_domains
_filter_namesr r )r) r# domainsnamesr r r r choose_namesn s
r2 )r0 r c C sD g }x:| D ]2}y|j tj| W q
tjk
r: w
Y q
X q
W |S )zHelper method for choose_names that implements basic checks
on domain names
:param list domains: Domain names to validate
:return: List of valid domains
:rtype: list
)appendr enforce_domain_sanityr
ConfigurationError)r0 Z
valid_domainsdomainr r r r. s
r. )FQDNsr c C s t | dd dS )zSort FQDNs by SLD (and if many, by their subdomains)
:param list FQDNs: list of domain names
:returns: Sorted list of domain names
:rtype: list
c S s | j dd d d dd S )N. )split)Zfqdnr r r