From ffe136f427ed768929730083a889bfd19d94d88e Mon Sep 17 00:00:00 2001 From: Nick Booker Date: Mon, 8 Jul 2019 13:22:36 +0100 Subject: [PATCH] [#57] Make redirect URL field tolerant of trailing / appended by user --- account_mtd/models/mtd_user_authorisation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/account_mtd/models/mtd_user_authorisation.py b/account_mtd/models/mtd_user_authorisation.py index 55f4b19..1cbfe94 100644 --- a/account_mtd/models/mtd_user_authorisation.py +++ b/account_mtd/models/mtd_user_authorisation.py @@ -18,7 +18,9 @@ class MtdUserAuthorisation(models.Model): @api.multi def get_user_authorisation(self, module_name=None, record=None): tracker_api = self.create_tracker_record(module_name, record) - redirect_uri = "{}/auth-redirect".format(record.hmrc_configuration.redirect_url) + normalised_redirect_url = \ + record.hmrc_configuration.redirect_url.rstrip('/') + redirect_uri = "{}/auth-redirect".format(normalised_redirect_url) state = "" # State is optional if record.hmrc_configuration.state: @@ -94,4 +96,4 @@ def create_tracker_record(self, module_name=None, record=None): 'module_name': module_name, 'company_id': record.company_id.id }) - return tracker_api \ No newline at end of file + return tracker_api