Skip to content

Commit

Permalink
Merge pull request #521 from dOpensource/transnexus_license_fix
Browse files Browse the repository at this point in the history
Fixed bug with Transnexus UI not able to be enabled
  • Loading branch information
mackhendricks committed Jul 10, 2023
2 parents 2315c50 + 94f1469 commit bad127f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 13 additions & 2 deletions gui/dsiprouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,14 @@ def displayTransNexus(msg=None):
if lc != settings_lc:
return render_template('license_required.html', msg='license is associated with another machine, re-associate it with this machine first')

return render_template('transnexus.html', msg=msg)
if settings.TRANSNEXUS_AUTHSERVICE_ENABLED == 1:
authservice_checked = 'checked'
transnexusOptions_hidden = 'hidden'
else:
authservice_checked = ''
transnexusOptions_hidden = ''

return render_template('transnexus.html', msg=msg,settings=settings,authservice_checked=authservice_checked,transnexusOptions_hidden=transnexusOptions_hidden)

except WoocommerceError as ex:
return render_template('license_required.html', msg=str(ex))
Expand Down Expand Up @@ -1823,7 +1830,11 @@ def addUpdateTransNexus():
# Update the TransNexus settings
tn_settings = {}
if 'authservice_enabled' in form:
tn_settings['TRANSNEXUS_AUTHSERVICE_ENABLED'] = form['authservice_enabled']
tn_settings['TRANSNEXUS_AUTHSERVICE_ENABLED'] = int(form['authservice_enabled'])
else:
# It was disabled so the form field was not sent over
tn_settings['TRANSNEXUS_AUTHSERVICE_ENABLED'] = 0

if 'authservice_host' in form:
tn_settings["TRANSNEXUS_AUTHSERVICE_HOST"] = form['authservice_host']

Expand Down
8 changes: 0 additions & 8 deletions gui/templates/transnexus.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
{% endblock %}

{% block body %}
{% if settings.TRANSNEXUS_AUTHSERVICE_ENABLED == 1 %}
{% set authservice_checked = 'checked' %}
{% set transnexusOptions_hidden = 'hidden' %}
{% else %}
{% set authservice_checked = '' %}
{% set transnexusOptions_hidden = '' %}
{% endif %}

<div class="col-md-12">
<form action="/transnexus" method="POST" role="form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
Expand Down

0 comments on commit bad127f

Please sign in to comment.