Commit 85484a3

mo <mo@mokhan.ca>
2017-11-24 21:38:50
extract partial for generating a response.
1 parent 84f9b20
app/views/sessions/_response.html.erb
@@ -0,0 +1,20 @@
+<div class="container">
+  <div class="row">
+    <div class="col">
+      <h1>Sending Response to Service Provider</h1>
+      <%= render partial: 'spinner' %>
+      <%= form_tag(@url, style: "position: absolute; left: -10000px; top: -10000px;") do %>
+        <% @saml_params.each do |(key, value)| %>
+          <%= hidden_field_tag key, value %>
+        <% end %>
+      <% end %>
+      <%= debug @saml_response.build.to_xhtml %>
+    </div>
+  </div>
+</div>
+
+<%= javascript_tag do %>
+  window.onload = function () {
+    window.setTimeout(function() { document.forms[0].submit(); }, 5000);
+  };
+<% end %>
app/views/sessions/create.html.erb
@@ -1,23 +1,1 @@
-<div class="container">
-  <div class="row">
-    <div class="col">
-      <%= render partial: 'spinner' %>
-      <%= form_tag(@url, style: "position: absolute; left: -10000px; top: -10000px;") do %>
-        <% @saml_params.each do |(key, value)| %>
-          <%= hidden_field_tag key, value %>
-        <% end %>
-      <% end %>
-      <%= debug @saml_response.build.to_xhtml %>
-    </div>
-  </div>
-</div>
-
-<%= javascript_tag do %>
-  function startTimer(duration) {
-    setInterval(function(){ if (--duration < 0) { document.forms[0].submit(); } }, 1000);
-  }
-  window.onload = function () {
-    var fiveSeconds = 5;
-    startTimer(fiveSeconds);
-  };
-<% end %>
+<%= render partial: "response" %>
app/views/sessions/destroy.html.erb
@@ -1,24 +1,1 @@
-<div class="container">
-  <div class="row">
-    <div class="col">
-      <%= render partial: 'spinner' %>
-      <h1>Logging Out of IDP</h1>
-      <%= form_tag(@url, style: "position: absolute; left: -10000px; top: -10000px;") do %>
-        <%= @saml_params.each do |(key, value)| %>
-          <%= hidden_field_tag key, value %>
-        <% end %>
-      <% end %>
-      <%= debug @saml_response.build.to_xhtml %>
-    </div>
-  </div>
-</div>
-
-<%= javascript_tag do %>
-  function startTimer(duration) {
-    setInterval(function(){ if (--duration < 0) { document.forms[0].submit(); } }, 1000);
-  }
-  window.onload = function () {
-    var fiveSeconds = 5;
-    startTimer(fiveSeconds);
-  };
-<% end %>
+<%= render partial: "response" %>