We can now specify a password

using the yunohost domain add command
This commit is contained in:
theo@manjaro 2022-07-01 10:38:25 +02:00
parent fdca22ca5b
commit 4f2a111470
3 changed files with 12 additions and 3 deletions

View file

@ -338,6 +338,7 @@
"domain_dns_registrar_yunohost": "This domain is a nohost.me / nohost.st / ynh.fr and its DNS configuration is therefore automatically handled by YunoHost without any further configuration. (see the 'yunohost dyndns update' command)", "domain_dns_registrar_yunohost": "This domain is a nohost.me / nohost.st / ynh.fr and its DNS configuration is therefore automatically handled by YunoHost without any further configuration. (see the 'yunohost dyndns update' command)",
"domain_dyndns_already_subscribed": "You have already subscribed to a DynDNS domain", "domain_dyndns_already_subscribed": "You have already subscribed to a DynDNS domain",
"domain_dyndns_root_unknown": "Unknown DynDNS root domain", "domain_dyndns_root_unknown": "Unknown DynDNS root domain",
"domain_password_no_dyndns": "The password is only used for subscribing to (and maybe later unsubscribing from) the DynDNS service",
"domain_exists": "The domain already exists", "domain_exists": "The domain already exists",
"domain_hostname_failed": "Unable to set new hostname. This might cause an issue later (it might be fine).", "domain_hostname_failed": "Unable to set new hostname. This might cause an issue later (it might be fine).",
"domain_registrar_is_not_configured": "The registrar is not yet configured for domain {domain}.", "domain_registrar_is_not_configured": "The registrar is not yet configured for domain {domain}.",

View file

@ -457,6 +457,12 @@ domain:
full: --dyndns full: --dyndns
help: Subscribe to the DynDNS service help: Subscribe to the DynDNS service
action: store_true action: store_true
-p:
full: --password
help: Password used to later delete the domain ( if subscribing to the DynDNS service )
extra:
pattern: *pattern_password
comment: dyndns_added_password
### domain_remove() ### domain_remove()
remove: remove:

View file

@ -131,14 +131,14 @@ def _get_parent_domain_of(domain):
@is_unit_operation() @is_unit_operation()
def domain_add(operation_logger, domain, dyndns=False): def domain_add(operation_logger, domain, dyndns=False,password=None):
""" """
Create a custom domain Create a custom domain
Keyword argument: Keyword argument:
domain -- Domain name to add domain -- Domain name to add
dyndns -- Subscribe to DynDNS dyndns -- Subscribe to DynDNS
password -- Password used to later unsubscribe from DynDNS
""" """
from yunohost.hook import hook_callback from yunohost.hook import hook_callback
from yunohost.app import app_ssowatconf from yunohost.app import app_ssowatconf
@ -183,7 +183,9 @@ def domain_add(operation_logger, domain, dyndns=False):
from yunohost.dyndns import dyndns_subscribe from yunohost.dyndns import dyndns_subscribe
# Actually subscribe # Actually subscribe
dyndns_subscribe(domain=domain) dyndns_subscribe(domain=domain,password=password)
elif password: # If a password is provided, while not subscribing to a DynDNS service
logger.warning(m18n.n("domain_password_no_dyndns"))
_certificate_install_selfsigned([domain], True) _certificate_install_selfsigned([domain], True)