HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/certbot/display/__pycache__/ops.cpython-38.pyc
U

�]1�@s�dZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZe�
e�ZejjZd+d
d�Zdd
�Zd,dd�Zd-dd�Zdd�Zdd�Zd.dd�Zd/dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd0d%d&�Z d'd(�Z!d)d*�Z"dS)1z+Contains UI methods for LE user operations.�N)�errors)�
interfaces)�util)�misc)�osFTcCs�d}d}d�tj�t�d�d��}|r>|r8||7}d}qBd}nd}z(ttj�j	|rZ||n|dd�\}}Wn$t
jk
r�d	}t
�|��YnX|tj
kr�|r�t
�d
��q�t
�d��nt�|�r�|S|r�||7}d}t|�}qBdS)
aJPrompt 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. zBEnter email address (used for urgent renewal and security notices)z�

If you really want to skip this, you can run the client with --register-unsafely-without-email but make sure you then backup your account key from {0}

Zconfig�accountsFT��force_interactivezoYou should register before running non-interactively, or provide --agree-tos and --email <email_address> flags.zHAn e-mail address or --register-unsafely-without-email must be provided.z#An e-mail address must be provided.N)�formatr�path�joinrZget_default_folder�z_utilr�IDisplay�inputrZMissingCommandlineFlag�display_util�OK�ErrorrZ
safe_email�bool)ZinvalidZoptionalZinvalid_prefix�msgZunsafe_suggestionZsuggest_unsafe�codeZemail�r�5/usr/lib/python3/dist-packages/certbot/display/ops.py�	get_emailsD
��
�
�
rcCs>dd�|D�}ttj�jd|dd�\}}|tjkr:||SdS)zuChoose an account.

    :param list accounts: Containing at least one
        :class:`~certbot.account.Account`

    cSsg|]
}|j�qSr)Zslug)�.0Zaccrrr�
<listcomp>Rsz"choose_account.<locals>.<listcomp>zPlease choose an accountTrN)r
rrZmenurr)r�labelsr�indexrrr�choose_accountJs
�

rcCs0ttj�j||dd�\}}|tjkr,|r,|SgS)z�Display screen to let user pick one or multiple values from the provided
    list.

    :param list values: Values to select from

    :returns: List of selected values
    :rtype: list
    T)�tagsr	)r
rr�	checklistrr)�values�questionr�itemsrrr�
choose_valuesZs	
�
r#cCs\|dkrt�d�t�St|���}t|�}|s8td�St||�\}}|tjkrX|rX|SgS)aQDisplay screen to select domains to validate.

    :param installer: An installer object
    :type installer: :class:`certbot.interfaces.IInstaller`

    :param `str` question: Overriding dialog 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 manuallyz1No names were found in your configuration files. )	�logger�debug�_choose_names_manually�listZ
get_all_names�get_valid_domains�
_filter_namesrr)Z	installerr!�domains�namesrrrr�choose_namesis

�r,c	CsBg}|D]4}z|�t�|��Wqtjk
r:YqYqXq|S)z�Helper 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)r*Z
valid_domains�domainrrrr(�sr(cCst|dd�d�S)z�Sort FQDNs by SLD (and if many, by their subdomains)

    :param list FQDNs: list of domain names

    :returns: Sorted list of domain names
    :rtype: list
    cSs|�d�ddd�dd�S)N�.����)�split)Zfqdnrrr�<lambda>��z_sort_names.<locals>.<lambda>)�key)�sorted)ZFQDNsrrr�_sort_names�sr9cCsDt|�}|r|}nd}ttj�j||ddd�\}}|dd�|D�fS)aDetermine which names the user would like to select from a list.

    :param list names: domain names

    :returns: tuple of the form (`code`, `names`) where
        `code` - str display exit code
        `names` - list of names selected
    :rtype: tuple

    z1Which names would you like to activate HTTPS for?�	--domainsT)r�cli_flagr	cSsg|]}t|��qSr)�str)r�srrrr�sz!_filter_names.<locals>.<listcomp>)r9r
rrr)r+Zoverride_questionZsorted_namesr!rrrrr)�s
�
r)�c
Cs2ttj�j|dddd�\}}|tjk�r.t�}d}zt�|�}Wn$tk
rfg}d�	t
j�}YnXt|�D]L\}}zt
�|�||<Wqptjk
r�}zt|�||<W5d}~XYqpXqp|�rd�	t
j�}|D]}|d	�	t
j|||�}q�|d
�	t
j�}|�r*ttj�j|dd�}	|	�r.t�Sn|SgS)z�Manually input names for those without an installer.

    :param str prompt_prefix: string to prepend to prompt for domains

    :returns: list of provided names
    :rtype: `list` of `str`

    zCPlease enter in your domain name(s) (comma and/or space separated) r:T)r;r	r>ziInternationalized domain names are not presently supported.{0}{0}Would you like to re-enter the names?{0}Nz<One or more of the entered domain names was not valid:{0}{0}z{1}: {2}{0}z+{0}Would you like to re-enter the names?{0}r)r
rrrrr�dictZseparate_list_input�UnicodeEncodeErrorr
r�linesep�	enumeraterr.rr/r<Zyesnor&)
Z
prompt_prefixrZinput_Zinvalid_domainsZ
retry_messageZdomain_list�ir0�eZretryrrrr&�s^	
��
��
 ������r&c	Cs4ttj�jd�t|�tjtj�t	|���dd�dS)zsDisplay a box confirming the installation of HTTPS.

    :param list domains: domain names which were enabled

    zdCongratulations! You have successfully enabled {0}{1}{1}You should test your configuration at:{1}{2}F��pauseN�
r
rr�notificationr
�_gen_https_namesrrAr�_gen_ssl_lab_urls�r*rrr�success_installation�s
��rLc	Cs4ttj�jd�t|�tjtj�t	|���dd�dS)z�Display a box confirming the renewal of an existing certificate.

    :param list domains: domain names which were renewed

    z�Your existing certificate has been successfully renewed, and the new certificate has been installed.{1}{1}The new certificate covers the following domains: {0}{1}{1}You should test your configuration at:{1}{2}FrENrGrKrrr�success_renewal�s
��rMcCs"ttj�jd�|tj�dd�dS)z�Display a box confirming a certificate has been revoked.

    :param list cert_path: path to certificate which was revoked.

    z\Congratulations! You have successfully revoked the certificate that was located at {0}{1}{1}FrEN)r
rrrHr
rrA)Z	cert_pathrrr�success_revocation
s
��rNcCsdd�|D�S)zNReturns a list of urls.

    :param list domains: Each domain is a 'str'

    cSsg|]}d|�qS)z1https://www.ssllabs.com/ssltest/analyze.html?d=%sr�r�domrrrr!sz%_gen_ssl_lab_urls.<locals>.<listcomp>rrKrrrrJsrJcCslt|�dkrd�|d�St|�dkr2dj|d�St|�dkrhd�d�d	d
�|dd�D��d
|d�SdS)z�Returns a string of the https domains.

    Domains are formatted nicely with https:// prepended to each.

    :param list domains: Each domain is a 'str'

    r3zhttps://{0}r�z%https://{dom[0]} and https://{dom[1]})rPz	{0}{1}{2}z, css|]}d|VqdS)z
https://%sNrrOrrr�	<genexpr>2sz#_gen_https_names.<locals>.<genexpr>Nr2z, and https://r>)�lenr
rrKrrrrI$s�rIc
Ks�|dk	rZz||�WnDtjk
rX}z$tjd||dd�td�|���W5d}~XYnX||fd|i|��\}}|tjkr�z||�||fWStjk
r�}z2tjd||dd�tj	�
tj�j
t|�dd�W5d}~XYq�XqZ||fSqZdS)	Nz>Encountered invalid default value "%s" when prompting for "%s"T)�exc_infozInvalid default "{0}"�defaultz/Validator rejected "%s" when prompting for "%s"FrE)rrr$r%�AssertionErrorr
rr�zope�	component�
getUtilityrrrHr<)�method�	validator�messagerU�kwargs�errorr�rawrrr�_get_validated9s.� 

�0r`cOsttj�tj�j|f|�|�S)a	Like `~certbot.interfaces.IDisplay.input`, but with validation.

    :param callable validator: A method which will be called on the
        supplied input. If the method raises a `errors.Error`, its
        text will be displayed and the user will be re-prompted.
    :param list `*args`: Arguments to be passed to `~certbot.interfaces.IDisplay.input`.
    :param dict `**kwargs`: Arguments to be passed to `~certbot.interfaces.IDisplay.input`.
    :return: as `~certbot.interfaces.IDisplay.input`
    :rtype: tuple
    )r`rWrXrYrrr�r[�argsr]rrr�validated_inputTs���rccOsttj�tj�j|f|�|�S)a=Like `~certbot.interfaces.IDisplay.directory_select`, but with validation.

    :param callable validator: A method which will be called on the
        supplied input. If the method raises a `errors.Error`, its
        text will be displayed and the user will be re-prompted.
    :param list `*args`: Arguments to be passed to `~certbot.interfaces.IDisplay.directory_select`.
    :param dict `**kwargs`: Arguments to be passed to
        `~certbot.interfaces.IDisplay.directory_select`.
    :return: as `~certbot.interfaces.IDisplay.directory_select`
    :rtype: tuple
    )r`rWrXrYrrZdirectory_selectrarrr�validated_directorycs���rd)FT)N)N)N)r>)N)#�__doc__ZloggingZzope.componentrWZcertbotrrrZcertbot.compatrrZcertbot.displayrZ	getLogger�__name__r$rXrYr
rrr#r,r(r9r)r&rLrMrNrJrIr`rcrdrrrr�<module>s4

7



6