2016-08-16 01:10:32 -04:00
|
|
|
<h1><%= t "user_api_key.title" %></h1>
|
|
|
|
<div>
|
2016-08-23 02:48:00 -04:00
|
|
|
<% if @no_trust_level %>
|
|
|
|
<h3>
|
|
|
|
<%= t("user_api_key.no_trust_level") %>
|
|
|
|
</h3>
|
|
|
|
<% elsif @generic_error %>
|
|
|
|
<h3>
|
|
|
|
<%= t("user_api_key.generic_error") %>
|
|
|
|
</h3>
|
|
|
|
<% else %>
|
2016-08-16 01:10:32 -04:00
|
|
|
<p>
|
|
|
|
<%= t("user_api_key.description", application_name: @application_name, access: @access_description) %>
|
|
|
|
</p>
|
|
|
|
<%= form_tag(user_api_key_path) do %>
|
|
|
|
<%= hidden_field_tag 'application_name', @application_name %>
|
|
|
|
<%= hidden_field_tag 'access', @access %>
|
|
|
|
<%= hidden_field_tag 'nonce', @nonce %>
|
|
|
|
<%= hidden_field_tag 'client_id', @client_id %>
|
|
|
|
<%= hidden_field_tag 'auth_redirect', @auth_redirect %>
|
|
|
|
<%= hidden_field_tag 'push_url', @push_url %>
|
|
|
|
<%= hidden_field_tag 'public_key', @public_key%>
|
2016-09-04 02:05:25 -04:00
|
|
|
<%= submit_tag t('user_api_key.authorize'), class: 'btn btn-danger', id: 'submit' %>
|
2016-08-16 01:10:32 -04:00
|
|
|
<% end %>
|
2016-09-04 02:05:25 -04:00
|
|
|
<script>
|
|
|
|
window.__submitted = false;
|
|
|
|
|
|
|
|
// prevent double submission which would invalidate the nonce
|
|
|
|
document.getElementById('submit').addEventListener('click', function(e){
|
|
|
|
if (window.__submitted) {
|
|
|
|
e.preventDefault();
|
|
|
|
} else {
|
|
|
|
window.__submitted = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2016-08-16 01:10:32 -04:00
|
|
|
</div>
|
2016-08-23 02:48:00 -04:00
|
|
|
<% end %>
|
2016-08-16 01:10:32 -04:00
|
|
|
|
|
|
|
|