invidious-copy-2022-08-14/src/invidious/views/authorize_token.ecr

78 lines
2.5 KiB
Text
Raw Normal View History

2019-04-18 21:23:50 +00:00
<% 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 %>