Skip to content

Commit

Permalink
Merge pull request #30 from Drieam/issue/29
Browse files Browse the repository at this point in the history
Autosubmit launch form on production (#29)
  • Loading branch information
StefSchenkelaars authored Feb 24, 2020
2 parents b31c843 + c69187b commit eb63cce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
39 changes: 23 additions & 16 deletions app/views/launches/auth.html.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
<h2>Launch payload</h2>
<pre style="overflow-x: auto">
<%= JSON.pretty_generate(@launch.payload) %>
</pre>
<% if Rails.env.development? %>
<h2>Launch payload</h2>
<pre style="overflow-x: auto">
<%= JSON.pretty_generate(@launch.payload) %>
</pre>

<h2>OIDC State</h2>
<pre style="overflow-x: auto">
<%= params[:state] %>
</pre>
<h2>OIDC State</h2>
<pre style="overflow-x: auto">
<%= params[:state] %>
</pre>

<h2>ID Token</h2>
<pre style="overflow-x: auto">
<%= @launch.id_token %>
</pre>
<h2>ID Token</h2>
<pre style="overflow-x: auto">
<%= @launch.id_token %>
</pre>
<% end %>

<%= form_tag @launch.target_link_uri, method: :post, id: 'ltiLaunchForm' do %>
<%= hidden_field_tag :state, params[:state] %>
<%= hidden_field_tag :id_token, @launch.id_token %>
<%= submit_tag 'Launch 🚀' %>
<% if Rails.env.development? %>
<%= submit_tag 'Launch 🚀' %>
<% end %>
<% end %>

<!--<script language='javascript'>-->
<!-- document.getElementById('ltiLaunchForm').submit();-->
<!--</script>-->
<%# Auto-submit the form when on production environment %>
<% if Rails.env.production? %>
<script language='javascript'>
document.getElementById('ltiLaunchForm').submit();
</script>
<% end %>


4 changes: 2 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ test:
#
production:
<<: *default
database: lti_launcher_production
username: lti_launcher
database: <%= ENV.fetch('DATABASE_DATABSE', 'lti_launcher_production') %>
username: <%= ENV.fetch('DATABASE_USERNAME', 'lti_launcher') %>
password: <%= ENV['LTI_LAUNCHER_DATABASE_PASSWORD'] %>

0 comments on commit eb63cce

Please sign in to comment.