From 3ff1fb4e10fdaef86527c10bd416e988d2a62a49 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Fri, 5 Apr 2013 01:03:44 -0700 Subject: login/login pages and cookie/session-based auth --- httemplate/loginout/login.html | 68 +++++++++++++++++++++++++++++++++++++++++ httemplate/loginout/logout.html | 28 ++++++----------- 2 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 httemplate/loginout/login.html (limited to 'httemplate/loginout') diff --git a/httemplate/loginout/login.html b/httemplate/loginout/login.html new file mode 100644 index 000000000..e5b45893b --- /dev/null +++ b/httemplate/loginout/login.html @@ -0,0 +1,68 @@ +<& /elements/header-minimal.html, 'Login' &> + + +
+ +
+ Login +

+ +% if ( $error ) { + <% $error |h %> +

+% } + +%#
+ + + + + + + + + + + + +
Username:
Password:
+
+ + + +
+ +
+ + +<%init> + +my %error = ( + 'no_cookie' => '', #First login, don't display an error + 'bad_cookie' => 'Bad Cookie', #timed out? server reboot? + 'bad_credentials' => 'Incorrect username / password', + 'logout' => 'You have been logged out.', +); + +my $url_string = CGI->new->url; + +my $error = $cgi->param('logout') || $r->prev->subprocess_env("AuthCookieReason"); +$error = exists($error{$error}) ? $error{$error} : $error; + +#fake a freeside path for /login so we get our .css. shrug +$url_string =~ s/login$/freeside\/login/ unless $url_string =~ /freeside\//; + +#even though this is kludgy and false laziness w/CGI.pm + $url_string =~ s{ / index\.html /? $ } + {/}x; + $url_string =~ + s{ + /(login|loginout) + ([\w\-\.\/]*) + $ + } + {}ix; + + $url_string .= '/' unless $url_string =~ /\/$/; + + diff --git a/httemplate/loginout/logout.html b/httemplate/loginout/logout.html index d8e1c634a..33b87feb0 100644 --- a/httemplate/loginout/logout.html +++ b/httemplate/loginout/logout.html @@ -1,18 +1,10 @@ - - - - - Logout page - - - -

-
- You have logged out. -
-

-
- You can log in again. -
- - +<% $cgi->redirect($fsurl.'?logout=logout') %> +<%init> + +my $auth_type = $r->auth_type; + +# Delete the cookie, etc. +$auth_type->logout($r); +#XXX etc: should delete the server-side session + + -- cgit v1.2.1