pagekite: Convert entered kite name to lower case

Let's Encrypt certificate paths use lower-case kite name.

Test: Pagekite functional tests are passing.

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 15:02:50 -04:00 committed by Veiko Aasa
parent 929e7626f0
commit 0b630037f9
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
2 changed files with 13 additions and 2 deletions

View File

@ -67,11 +67,17 @@ class ConfigurationForm(forms.Form):
old = _filter(self.initial)
new = _filter(self.cleaned_data)
# Kite name should be ASCII. If it's unicode, convert to
# ASCII.
kite_name = str(new['kite_name'])
# Let's Encrypt certificate paths use lower-case kite name.
kite_name = kite_name.lower()
if old != new:
frontend = f"{new['server_domain']}:{new['server_port']}"
utils.run([
'set-config', '--kite-name', new['kite_name'], '--frontend',
frontend
'set-config', '--kite-name', kite_name, '--frontend', frontend
], input=new['kite_secret'].encode())
messages.success(request, _('Configuration updated'))

View File

@ -23,6 +23,11 @@ Scenario: Configure pagekite application
When I configure pagekite with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
Scenario: Capitalized kite name
Given the pagekite application is enabled
When I configure pagekite with host pagekite.example.com, port 8080, kite name Mykite.example.com and kite secret mysecret
Then pagekite should be configured with host pagekite.example.com, port 8080, kite name mykite.example.com and kite secret mysecret
@backups
Scenario: Backup and restore pagekite
Given the pagekite application is enabled