Skip to content

Commit

Permalink
[8.0][#57] Make MTD authorisation tolerant of trailing / on redirec…
Browse files Browse the repository at this point in the history
…t URL configured by user

Merge pull request #59 from OpusVL/mtd-vat-8.0-57-tolerate-trailing-slash-on-redirect-url
  • Loading branch information
Nick-OpusVL authored Jul 8, 2019
2 parents c764ee0 + ffe136f commit c6e452a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions account_mtd/models/mtd_user_authorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
return tracker_api

0 comments on commit c6e452a

Please sign in to comment.