discourse/app/views/users/activate_account.html.erb

45 lines
1.4 KiB
Text
Raw Normal View History

2013-02-05 14:16:51 -05:00
<div id='simple-container'>
<h2><%= t 'activation.welcome_to', site_name: SiteSetting.title %></h2>
<br/>
<button class='btn' id='activate-account-button'><%= t 'activation.action' %></button>
<%= form_tag(perform_activate_account_path, method: :put, id: 'activate-account-form') do %>
<%= hidden_field_tag 'password_confirmation' %>
<%= hidden_field_tag 'challenge' %>
2013-02-05 14:16:51 -05:00
<% end %>
</div>
2013-02-25 11:42:20 -05:00
<%- content_for(:no_ember_head) do %>
2015-11-25 06:47:07 -05:00
<%= script "ember_jquery" %>
<%= script "vendor" %>
<%= render_google_universal_analytics_code %>
<%- end %>
<script language="javascript">
(function() {
function activateAccount() {
$('#activate-account-button').prop('disabled', true);
$.ajax("<%= path "/users/hp" %>").then(function(hp) {
$('#password_confirmation').val(hp.value);
$('#challenge').val(hp.challenge.split("").reverse().join(""));
$('#activate-account-form').submit();
}).fail(function() {
$('#activate-account-button').prop('disabled', false);
});
}
2013-02-05 14:16:51 -05:00
var t0 = new Date().getTime();
$('#activate-account-button').on('click', function() {
var diff = new Date().getTime() - t0;
// Ensure the form has been visible for a few ms before allowing the
// user to submit.
if (diff > 50) {
activateAccount();
}
});
})();
</script>
<%= render_google_analytics_code %>