Kevin M. Brooks (lucretio) wrote in fotobilder,
Kevin M. Brooks
lucretio
fotobilder

[PATCH] return to referer after login.

If I go to /manage/ while I'm logged out, I'd like it to send me back to /manage/ once I log in. It currently doesn't do that.

Here is a patch that should do it: 2002-08-25-returnafterlogin.patch.txt
This patch is currently untested. (Is it too early for a goathack-esque fotobilder development server?)

main -> fb                htdocs/login
--- /home/lucretio/fb/cvs/fb/htdocs/login	2002-08-06 05:46:54.000000000 -0500
+++ /home/lucretio/fb/htdocs/login	2002-08-25 14:39:52.000000000 -0500
@@ -73,6 +73,10 @@
     # set cookie
     $BML::COOKIE{'fbsession'} = [ "ws:$u->{'user'}:$sess->{'sessid'}:$sess->{'auth'}", $exptime ];
 
+    if ($FORM{'ref'} =~ /\Q$FB::DOMAIN\E/ && $FORM{'ref'} !~ /[\n\r]/) {
+        return BML::redirect("$FORM{'ref'}");
+    }
+
     return login_form($u);
 
 }
@@ -109,6 +113,12 @@
    # need to start form no matter what
    $ret .= "
\n"; + my $referer = BML::get_client_header('Referer'); + if ($FORM{'ret'} && $referer) { + my $eh_ref = FB::ehtml($referer); + $ret .= "\n"; + } + unless ($u) { my $chal = FB::generate_challenge(undef); # don't know user yet $ret .= "\n"; main -> fb htdocs/manage/gal --- /home/lucretio/fb/cvs/fb/htdocs/manage/gal 2002-08-25 03:46:04.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/gal 2002-08-25 14:42:10.000000000 -0500 @@ -4,7 +4,7 @@ use vars qw(%FORM %GET $title $body); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; my $dbu = FB::get_user_db_reader($u); my $gallid = $GET{'id'}+0; main -> fb htdocs/manage/gals --- /home/lucretio/fb/cvs/fb/htdocs/manage/gals 2002-08-25 03:46:04.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/gals 2002-08-25 14:43:12.000000000 -0500 @@ -7,7 +7,7 @@ use vars qw(%FORM); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; my $ret; my $udbr = FB::get_user_db_reader($u); main -> fb htdocs/manage/groups --- /home/lucretio/fb/cvs/fb/htdocs/manage/groups 2002-08-06 05:46:54.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/groups 2002-08-25 14:43:26.000000000 -0500 @@ -8,7 +8,7 @@ use vars qw(%GET %POST $u $udbr); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; my $udbr = FB::get_user_db_reader($u); main -> fb htdocs/manage/index.bml --- /home/lucretio/fb/cvs/fb/htdocs/manage/index.bml 2002-07-28 00:12:06.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/index.bml 2002-08-25 14:41:54.000000000 -0500 @@ -4,7 +4,7 @@ {'user'}!" : BML::redirect("$FB::SITEROOT/login"); + return $remote ? "Hello, $remote->{'user'}!" : BML::redirect("$FB::SITEROOT/login?ret=1"); } _code?> main -> fb htdocs/manage/layer --- /home/lucretio/fb/cvs/fb/htdocs/manage/layer 2002-08-18 23:12:22.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/layer 2002-08-25 14:43:40.000000000 -0500 @@ -4,7 +4,7 @@ use vars qw(%POST %GET $title $body); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; $body = ""; $title = "Edit Layer"; main -> fb htdocs/manage/pic --- /home/lucretio/fb/cvs/fb/htdocs/manage/pic 2002-08-06 05:46:54.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/pic 2002-08-25 14:43:52.000000000 -0500 @@ -4,7 +4,7 @@ use vars qw(%GET %POST $title $body); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; my $dbu = FB::get_user_db_reader($u); my $upicid = $GET{'id'}+0; main -> fb htdocs/manage/pics --- /home/lucretio/fb/cvs/fb/htdocs/manage/pics 2002-08-06 05:46:54.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/pics 2002-08-25 14:44:02.000000000 -0500 @@ -5,7 +5,7 @@ my $u = FB::get_remote(); unless ($u) { - return BML::redirect("$FB::SITEROOT/login"); + return BML::redirect("$FB::SITEROOT/login?ret=1"); } my $dbu = FB::get_user_db_reader($u); main -> fb htdocs/manage/style --- /home/lucretio/fb/cvs/fb/htdocs/manage/style 2002-08-25 14:28:32.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/style 2002-08-25 14:44:14.000000000 -0500 @@ -4,7 +4,7 @@ use vars qw(%POST %GET $title $body); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; FB::load_user_props($u, "styleid"); $body = ""; main -> fb htdocs/manage/styles --- /home/lucretio/fb/cvs/fb/htdocs/manage/styles 2002-08-25 03:46:04.000000000 -0500 +++ /home/lucretio/fb/htdocs/manage/styles 2002-08-25 14:44:24.000000000 -0500 @@ -4,7 +4,7 @@ use vars qw(%POST %GET $title $body); my $u = FB::get_remote(); - return BML::redirect("$FB::SITEROOT/login") unless $u; + return BML::redirect("$FB::SITEROOT/login?ret=1") unless $u; FB::load_user_props($u, "styleid"); my $dbu = FB::get_user_db_reader($u);
Subscribe

  • 302: lj_dev

    In the interests of consolidating all FotoBilder development-related discussion, we're going to be closing down this community. The same…

  • Development stalled?

    Is the development of Fotobilder held? Stalled? I am asking because there is no activity on the community and there is no link to the Fotobilder…

  • (no subject)

    Does FotoBilder works with Apache2? I installed all the required modules on my debian sarge, and when I restart my apache server, it dies horribly…

  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic
  • 0 comments