<%args>
  $secret => undef
  $doit   => undef
</%args>
<h1>
  <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CLEAR_SECRET_TITLE') %>
</h1>
<p>
  <% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_API_CLEAR_SECRET_DESCRIPTION') %>
</p>

<& /service/open_form.mhtml &>

<& /lib/html/hidden.mhtml, 'name' => 'secret', 'value' => $secret &>
<& /lib/html/hidden.mhtml, 'name' => 'doit',   'value' => '1' &>

<& /service/send_form.mhtml &>
<& /service/close_form.mhtml &>

<%init>
  if (defined $doit and $doit)
  {
    ## somebody submitted the form

    my $msg  = $context->{client}->send_receive_command_msg (
                   "clear_secret", {SECRET => $secret});
    if ($msg->{SERVICE_MSG} eq "ERROR")
    {
        print "<h1>".$msg->{LIST}->[0]->{LABEL}."</h1>\n";
        print "<p>".$msg->{LIST}->[0]->{PARAMS}->{ERROR}."</p>\n";
        return 1;
    }
    return $m->comp ('key_list.html');
  }
</%init>
