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 authored and Veiko Aasa committed 2021-03-29 12:59:32 +03:00
1 parent 929e7626f0
commit 0b630037f9
2 files changed
+13 -2

No files matched your search

+8 -2
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'))
@@ -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