config: Convert entered domain name to lower case

Domain name is not case sensitive, but Let's Encrypt certificate paths
use lower-case domain name.

Closes: #1964.

Tests: Config functional tests passed.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
James Valleroy 2021-03-23 08:22:44 -04:00 committed by Veiko Aasa
parent adae894362
commit 043b329e7d
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
2 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,10 @@ Scenario: Change domain name
When I change the domain name to mydomain.example
Then the domain name should be mydomain.example
Scenario: Capitalized domain name
When I change the domain name to Mydomain.example
Then the domain name should be mydomain.example
Scenario: Change webserver home page
Given the syncthing application is installed
And the syncthing application is enabled

View File

@ -120,6 +120,10 @@ def set_domainname(domainname, old_domainname):
# Domain name should be ASCII. If it's unicode, convert to ASCII.
domainname = str(domainname)
# Domain name is not case sensitive, but Let's Encrypt certificate
# paths use lower-case domain name.
domainname = domainname.lower()
LOGGER.info('Changing domain name to - %s', domainname)
actions.superuser_run('domainname-change', [domainname])