invidious-experimenting/src/invidious/views/authorize_token.ecr
2019-05-01 20:03:39 -05:00

79 lines
2.8 KiB
Plaintext

<% content_for "header" do %>
<title><%= translate(locale, "Token") %> - Invidious</title>
<% end %>
<% if env.get? "access_token" %>
<div class="pure-g h-box">
<div class="pure-u-1-3">
<h3>
<%= translate(locale, "Token") %>
</h3>
</div>
<div class="pure-u-1-3" style="text-align:center">
<h3>
<a href="/token_manager"><%= translate(locale, "Token manager") %></a>
</h3>
</div>
<div class="pure-u-1-3" style="text-align:right">
<h3>
<a href="/preferences"><%= translate(locale, "Preferences") %></a>
</h3>
</div>
</div>
<div class="h-box">
<h4 style="padding-left:0.5em">
<code><%= env.get "access_token" %></code>
</h4>
</div>
<% else %>
<div class="h-box">
<form class="pure-form pure-form-aligned" action="/authorize_token" method="post">
<% if callback_url %>
<legend><%= translate(locale, "Authorize token for `x`?", "#{callback_url.scheme}://#{callback_url.host}") %></legend>
<% else %>
<legend><%= translate(locale, "Authorize token?") %></legend>
<% end %>
<div class="pure-g">
<div class="pure-u-1">
<ul>
<% scopes.each do |scope| %>
<li><%= scope %></li>
<% end %>
</ul>
</div>
</div>
<div class="pure-g">
<div class="pure-u-1-2">
<button type="submit" name="submit" value="clear_watch_history" class="pure-button pure-button-primary">
<%= translate(locale, "Yes") %>
</button>
</div>
<div class="pure-u-1-2">
<% if callback_url %>
<a class="pure-button" href="<%= callback_url %>">
<% else %>
<a class="pure-button" href="/">
<% end %>
<%= translate(locale, "No") %>
</a>
</div>
</div>
<% scopes.each_with_index do |scope, i| %>
<input type="hidden" name="scopes[<%= i %>]" value="<%= scope %>">
<% end %>
<% if callback_url %>
<input type="hidden" name="callbackUrl" value="<%= callback_url %>">
<% end %>
<% if expire %>
<input type="hidden" name="expire" value="<%= expire %>">
<% end %>
<input type="hidden" name="csrf_token" value="<%= URI.escape(csrf_token) %>">
</form>
</div>
<% end %>