1 if ( form submission is login request ) {
2 check login details, if wrong print error and quit
3 $authreq->record_login(...username...);
5 if ( !$authreq->check() ) {
6 display login form, quit
9 if ( form submission is login request ) {
10 check login details, if wrong print error and quit
11 $authreq->record_login(...username...);
13 if ( form submission is logout request ) {
14 die unless $authreq->mutate();
15 my $logged_out_user = $authreq->logout();
16 if (!defined $logged_out_user) {
17 print "you are not logged in" error and quit
19 print "goodbye $username you are now logged out" and quit
22 if ( !$authreq->check() ) {
23 display login form, quit
27 - user can sort of log out by clearing cookies
28 - sophisticated applications can have get-requests