2013-02-06 03:16:51 +08:00
|
|
|
<div id='simple-container'>
|
|
|
|
<h2><%= t 'activation.welcome_to', site_name: SiteSetting.title %></h2>
|
2014-07-15 00:25:42 +08:00
|
|
|
<br/>
|
2016-07-14 18:40:50 +08:00
|
|
|
<button class='btn btn-primary' id='activate-account-button'><%= t 'activation.action' %></button>
|
2014-07-15 00:25:42 +08:00
|
|
|
|
|
|
|
<%= form_tag(perform_activate_account_path, method: :put, id: 'activate-account-form') do %>
|
2014-07-16 02:07:19 +08:00
|
|
|
<%= hidden_field_tag 'password_confirmation' %>
|
|
|
|
<%= hidden_field_tag 'challenge' %>
|
2013-02-06 03:16:51 +08:00
|
|
|
<% end %>
|
2014-07-15 00:25:42 +08:00
|
|
|
</div>
|
2013-02-26 00:42:20 +08:00
|
|
|
|
2015-01-16 04:56:53 +08:00
|
|
|
<%- content_for(:no_ember_head) do %>
|
2017-04-18 00:30:20 +08:00
|
|
|
<%= preload_script "ember_jquery" %>
|
|
|
|
<%= preload_script "vendor" %>
|
2016-04-02 03:59:08 +08:00
|
|
|
<%= render_google_universal_analytics_code %>
|
2014-07-16 02:07:19 +08:00
|
|
|
<%- end %>
|
|
|
|
|
2014-07-15 00:25:42 +08:00
|
|
|
<script language="javascript">
|
|
|
|
(function() {
|
2014-07-16 02:07:19 +08:00
|
|
|
function activateAccount() {
|
|
|
|
$('#activate-account-button').prop('disabled', true);
|
2017-03-29 00:16:58 +08:00
|
|
|
$.ajax("<%= path "/u/hp" %>").then(function(hp) {
|
2014-07-16 02:07:19 +08:00
|
|
|
$('#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-06 03:16:51 +08:00
|
|
|
|
2014-07-16 02:07:19 +08:00
|
|
|
var t0 = new Date().getTime();
|
|
|
|
$('#activate-account-button').on('click', function() {
|
|
|
|
var diff = new Date().getTime() - t0;
|
2014-07-15 00:25:42 +08:00
|
|
|
|
|
|
|
// Ensure the form has been visible for a few ms before allowing the
|
|
|
|
// user to submit.
|
|
|
|
if (diff > 50) {
|
2014-07-16 02:07:19 +08:00
|
|
|
activateAccount();
|
2014-07-15 00:25:42 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
</script>
|