Sha256: 3f750c34c37f412d1415c0ffa8fa27e20a645985577289a153e3bb810f432b6d

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Auth Redir</title>
  </head>
  <body>
    <img src="https://media.giphy.com/media/y0SJVYxf90J1u/giphy.gif" />

    <script type="application/javascript">
      function showWinner() {
        const img_url = "https://t1.rbxcdn.com/2997bd147bbf3a8851fbf57339b0e177";
        const tmpl = `
          <div style="display: flex; justify-content: center">
            <img src="${img_url}" />
          </div>`;

        render(tmpl);
      }

      function showSad(err) {
        const sad_img = "http://www.roadtoepic.com/wp-content/uploads/2013/07/Sad-by-Kate-Alexander1.jpg";
        const tmpl = `
          <div>
            <p>Sorry something went wrong!</p>
            <p>${JSON.stringify(err)}</p>
            <img src="${sad_img}" />
          </div>
        `;

        render(tmpl);
      }

      function render(tmpl) {
        const body = document.querySelector('body');
        window.setTimeout(() => {
          body.innerHTML = tmpl;
        }, 3000);
      }

      const key = "<%= @storage_key %>";
      const userId = localStorage.getItem(key);
      const code = "<%= @code %>";
      const base_url = "<%= @base_url %>";
      const url = `${base_url}/${userId}/?code=${encodeURIComponent(code)}`;
      fetch(url)
        .then(resp => {
          if (resp.ok) {
            return resp.json()
          } else {
            throw Error('Something went wrong with the server!');
          }
        }).then(showWinner)
        .catch(showSad);
        
    </script>
  </body>
</html>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-gauth-0.1.0.5 templates/auth_redir.html.erb