diff --git a/CHANGELOG b/CHANGELOG index 1953dd3dc1e410d01c488c80d65e51904c240c4a..00b32f68e7158d65b4af7db1148d7031115b2783 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ smasch (1.0.0~beta.3-1) unstable; urgency=low * bug fix: upgrade from 0.15 version containing subjects failed + * bug fix: language import was not allowed + * bug fix: empty NEXMO_DEFAULT_FROM did not allow to send authentication + tokens using NEXMO (#364) -- Piotr Gawron <piotr.gawron@uni.lu> Tue, 12 Jan 2021 10:00:00 +0200 diff --git a/smash/web/migrations/0176_configurationitem_local_setting_clean.py b/smash/web/migrations/0176_configurationitem_local_setting_clean.py index b2506ca55530c84be2ff5c960fb36f736c7dc503..b9289a0dd11b2065bd32514bbb3d3502e9d4b2e7 100644 --- a/smash/web/migrations/0176_configurationitem_local_setting_clean.py +++ b/smash/web/migrations/0176_configurationitem_local_setting_clean.py @@ -66,6 +66,8 @@ def configuration_items(apps, schema_editor): create_item(apps, NEXMO_API_SECRET, nexmo_api_secret, "NEXMO API SECRET") nexmo_api_from = getattr(settings, 'NEXMO_DEFAULT_FROM', '') + if nexmo_api_from is None or nexmo_api_from == "": + nexmo_api_from = "SMASCH" create_item(apps, NEXMO_DEFAULT_FROM, nexmo_api_from, "The sender of the message from NEXMO (phone number or text)") background_image = getattr(settings, "LOGIN_PAGE_BACKGROUND_IMAGE", "background.jpg") diff --git a/smash/web/nexmo_gateway.py b/smash/web/nexmo_gateway.py index 4191639277ed298ed9a3675dc3ac75166d1de78c..70a116f4a39d88fd2cfaf958fa0a44ac99296486 100644 --- a/smash/web/nexmo_gateway.py +++ b/smash/web/nexmo_gateway.py @@ -32,6 +32,8 @@ class Nexmo: api_secret = ConfigurationItem.objects.get(type=NEXMO_API_SECRET).value self.client = nexmo.Client(key=api_key, secret=api_secret) self.default_from = ConfigurationItem.objects.get(type=NEXMO_DEFAULT_FROM).value + if self.default_from is None or self.default_from == "": + self.default_from = "SMASCH" def send_sms(self, device, token): body = 'Your authentication token is %s' % token