PFB5ZUQWW67FRYY54QGTAVTWYMUKXLXRA2XCY3IWK6HZNE6DDLFAC
XUKHBDR5HJKYJ7GEWTL4YLQEW2S4ERU2WVQZU3INIJB34B4CTUKAC
XJRJ4J7M6BC433TBLWHHKX7UYYCFX6M7ZQLUEYYTREPCSM6M3RDQC
LZVO64YG43JD7YMZSCTZNOBS5ROZA4FMPKJW2YOMHX2V5PTGBVWQC
36ZTCZ4FDV6ILURQEIGFHCP57ALZH6OWYNN3MBXG2QXZSBULBPMAC
XMB4MTRLVDDXF6ISVXXEKEFU2KRTQHHV3UJEWRXQOZAOYAEFPQBAC
2CZSW5S53UW7ACDNT5T3UQNJKFBCXCBYLQ5CL6GVCCOMKBGXZIEQC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
OEPUOUNBNTHTFZVDXREGBQCKFRCWMVP2MDVK4OA47VK2DBKEWVYAC
RU7AQO7U4HCWJNQTR2KRGDLLG24WYD47MWIHREV6SIAPCPDQHAWQC
JARRBLZDQ2JZWY7IUVPTOT7WJMBPMLFLF2MGLVGOYROAAISYGLSAC
if ($c->request->looks_like_browser) {
$c->response->redirect($c->request->referer || $c->uri_for('/'));
} else {
$self->status_no_content($c);
}
}
sub logout_GET {
# Probably a better way to do this
my ($self, $c) = @_;
logout_POST($self, $c);
$self->status_no_content($c);
$c->flash->{successMsg} = "You are now signed in as <tt>" . encode_entities($email) . "</tt>";
}
sub persona_logout :Path('/persona-logout') Args(0) {
my ($self, $c) = @_;
$c->stash->{json} = {};
requirePost($c);
$c->flash->{flashMsg} = "You are no longer signed in." if $c->user_exists();
$c->logout;
$c->flash->{successMsg} = "You are now signed in as <tt>" . encode_entities($email) . "</tt>.";
navigator.id.watch({
loggedInUser: [% c.user_exists ? '"' _ HTML.escape(c.user.username) _ '"' : "null" %],
onlogin: function(assertion) {
$.post("[% c.uri_for('/persona-login') %]", { assertion: assertion })
.done(function(data) {
if (data.error)
bootbox.alert("Login failed: " + data.error);
else
window.location.reload();
})
.fail(function() { bootbox.alert("Server request failed!"); });
},
onlogout: function() {
$.post("[% c.uri_for('/persona-logout') %]")
.done(function(data) {
window.location.reload();
})
.fail(function() { bootbox.alert("Server request failed!"); });
}
});
function doLogout() {
$.post("[% c.uri_for('/logout') %]")
.done(function(data) {
window.location.reload();
})
.fail(function() { bootbox.alert("Server request failed!"); });
}
</script>
$("#persona-signout").click(function() {
navigator.id.logout();
});
</script>
<script>
navigator.id.watch({
loggedInUser: [% c.user_exists ? '"' _ HTML.escape(c.user.username) _ '"' : "null" %],
onlogin: function(assertion) {
$.post("[% c.uri_for('/persona-login') %]", { assertion: assertion })
.done(function(data) {
if (data.error)
bootbox.alert("Login failed: " + data.error);
else
window.location.reload();
})
.fail(function() { bootbox.alert("Server request failed!"); });
},
onlogout: doLogout
});
<p class="btn-info btn-large">
You are already logged in as <tt>[% c.user.username %]</tt>.
You can <a href="[% c.uri_for('/logout') %]">logout</a> here.
<p class="alert alert-info">
You are already signed in as <tt>[% HTML.escape(c.user.username) %]</tt>.