diff options
author | Jan UrbaĆski | 2009-11-26 13:34:15 +0000 |
---|---|---|
committer | Robert Haas | 2009-11-26 13:35:30 +0000 |
commit | c7a94d40a473938a29609ab80484881b5e553935 (patch) | |
tree | 0a935f74080963413d08c3a204b60300279ee999 | |
parent | 148682adfa1bc959390319abad74dd5c1d948ff1 (diff) |
Always go back to the page you were on after logging in.
-rw-r--r-- | perl-lib/PgCommitFest/Request.pm | 12 | ||||
-rw-r--r-- | template/header.tt2 | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/perl-lib/PgCommitFest/Request.pm b/perl-lib/PgCommitFest/Request.pm index a12ab4a..dc75d92 100644 --- a/perl-lib/PgCommitFest/Request.pm +++ b/perl-lib/PgCommitFest/Request.pm @@ -199,6 +199,17 @@ sub render_template { # reasonable if we've already begun sending the response back to Apache. my %stash; my $content = $self->generate_headers(); + my $uri = ''; + if ($ENV{'REQUEST_METHOD'} eq 'GET') { + if ($ENV{'SCRIPT_NAME'} ne '/action/login') { + my $req = $ENV{'REQUEST_URI'}; + $req =~ s/[^A-Za-z0-9]/sprintf "%%%x", ord($&)/ge;; + $uri = '?uri=' . $req; + } + else { + $uri = '?' . $ENV{'QUERY_STRING'}; + } + } %stash = %$vars if defined $vars; $stash{'authenticate'} = $self->authenticate(); $stash{'control'} = $self->{'control'}; @@ -209,6 +220,7 @@ sub render_template { 'title' => $self->{'title'}, 'error_list' => $self->{'error_list'}, 'script_name' => $ENV{'SCRIPT_NAME'}, + 'uri' => $uri, }, \$content) || die $template->error(); $template->process($file . '.tt2', \%stash, \$content) || die $template->error(); diff --git a/template/header.tt2 b/template/header.tt2 index 4fd8018..7e531a6 100644 --- a/template/header.tt2 +++ b/template/header.tt2 @@ -17,7 +17,7 @@ </td> <td id="commitfestNav"> [% IF authenticate.userid.defined %]Welcome, [% authenticate.userid | htmlsafe %] - <a href='/https/git.postgresql.org/action/logout'>Log Out</a> - [% ELSE %]<a href='/https/git.postgresql.org/action/login'>Log In</a> + [% ELSE %]<a href='/https/git.postgresql.org/action/login[% uri %]'>Log In</a> [% END %] - <a href='/'>Home Page</a> </td> |