<div class="wrap">
  <div class="app">
    <h1><%= provider_name %></h1>
    <h2><%= app[:name] %></h2>
    <h3><a href="/">Back</a></h3>
    <div class="boxes">
      <div>
        <h2>Quick actions</h2>
        <% if token.role != 'admin' %>
        <form action="/app/<%= client_id %>/deauthorize" method="POST">
          <%== csrf_tag %>
          <button type="submit" class="red">Deauthorize</button>
        </form>
        <% else %>
        <form action="/app/<%= client_id %>/regenerate" method="POST">
          <%== csrf_tag %>
          <button type="submit" class="red">Regenerate client secret</button>
        </form>
        <% end %>
      </div>
      <% if token.role == 'admin' %>
      <div>
        <h2>Info</h2>
        <div><strong>Client id:</strong> <%= client_id %></div>
        <div><strong>Client secret:</strong> <%= app[:secret] %></div>
        <div><strong>Private:</strong> <%= app[:private] %></div>
      </div>
      <div>
        <h2>Users</h2>
        <ul>
          <% app.users.each do |user| %>
          <li><%= user.username %></li>
          <% end %>
        </ul>
      </div>
      <div>
        <h2>Admins</h2>
        <ul>
          <% app.admins.each do |user| %>
          <li><%= user.username %></li>
          <% end %>
        </ul>
      </div>
      <% end %>
    </div>
  </div>
</div>