%perl> eval { my $msg = $context->{client}->collect(); die i18nGettext("I18N_OPENXPKI_CLIENT_HTML_MASON_LOGOUT_OK") if (not $msg); use Data::Dumper; print Dumper ($msg); }; if (! $EVAL_ERROR) { ## HORROR: the session is still open !!! %perl>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_LOGOUT_FAILED_DESCRIPTION') %>
% } else {<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_LOGOUT_SUCCESS_DESCRIPTION') %>
<% i18nGettext('I18N_OPENXPKI_CLIENT_HTML_MASON_LOGOUT_NEW_LOGIN') %>
% } % undef $context; # cleanup the context <%init> ## this is so unclean that Mason cannot handle it via syshandler use English; use CGI::Cookie; my $cookies = CGI::Cookie->fetch(); if (defined $cookies && exists $cookies->{'openxpki_sessionid'}) { # session ID cookie exists, we have to delete it # a cookie with a negative expiration date is equivalent to # deleting it ... my $c = CGI::Cookie->new( -name => 'openxpki_sessionid', -expires => '-1M', -path => '/', ); $r->headers_out->set('Set-Cookie' => $c); } ## kill the session on the server ## we need to send a CONTINUE_SESSION for that, so that we end ## up in a state in which we can actually send LOGOUT (otherwise ## we might be stuck with a server that believes we are still in ## the authentication phase) $context->{client}->init_session({ SESSION_ID => $context->{'session_id'}, }); $context->{client}->send_service_msg ("LOGOUT"); ## the connection should now be closed by the server %init>