Tadashi Okoshi
slash****@users*****
2005年 12月 19日 (月) 12:35:04 JST
Index: affelio/bin/loginexec.cgi
diff -u affelio/bin/loginexec.cgi:1.14 affelio/bin/loginexec.cgi:1.15
--- affelio/bin/loginexec.cgi:1.14 Mon Dec 19 12:10:29 2005
+++ affelio/bin/loginexec.cgi Mon Dec 19 12:35:04 2005
@@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: loginexec.cgi,v 1.14 2005/12/19 03:10:29 slash5234 Exp $
+# $Id: loginexec.cgi,v 1.15 2005/12/19 03:35:04 slash5234 Exp $
use strict;
@@ -61,6 +61,7 @@
my $username = $wi->PTN_word($q->param("username"));
my $password = $wi->PTN_through($q->param("password"));
my $forward_URL = $wi->PTN_URL($q->url_param("forward_URL"));
+my $aftergo_URL = $wi->PTN_URL($q->url_param("aftergo_URL"));
my $submit_type = $wi->PTN_mode($q->param("submittype"));
#Make farm URL in which this Affelio belongs to.
@@ -72,6 +73,7 @@
debug_print("\t\tusername = $username");
debug_print("\t\tpassword = $password");
debug_print("\t\tforward = $forward_URL");
+debug_print("\t\taftergo = $aftergo_URL");
debug_print("\t\tfarm_URL = $farm_URL");
#output data
@@ -141,20 +143,28 @@
show_checkpassword_screen(mode => "login_as_owner");
exit(1);
}
-
+
+
+ ##################################
+ #Determine aftergo_URL
+ ##################################
+ #aftergo_URL is a URL to which the user will be forwarded after auth.
+ if($aftergo_URL eq ""){
+ $aftergo_URL= $ENV{HTTP_REFERER};
+ }
+
##################################
#Determine forward_URL
##################################
- #Forward_URL is a URL to which the user will be forwarded after auth.
if($forward_URL eq ""){
- $forward_URL= $ENV{HTTP_REFERER};
+ $forward_URL= $af->{site__web_root};
}
##################################
#Go to "s1" phase...
##################################
my $next_URL
- = "$affelio_url/bin/loginexec.cgi?mode=s1&forward_URL=$forward_URL";
+ = "$affelio_url/bin/loginexec.cgi?mode=s1&forward_URL=$forward_URL&aftergo_URL=$aftergo_URL";
debug_print("\t\tnext_URL= $next_URL");
debug_print("loginexec.cgi($mode): end.");
print $q->redirect( -url => $next_URL);
@@ -176,11 +186,11 @@
#(auth check phase)
debug_print("loginexec.cgi($mode): submit_type= $submit_type");
if($submit_type eq "Cancel"){
- if($forward_URL eq ""){
+ if($aftergo_URL eq ""){
print $q->redirect( -url => $af->{site__web_root});
exit;
}else{
- print $q->redirect( -url => $forward_URL);
+ print $q->redirect( -url => $aftergo_URL);
exit;
}
@@ -229,6 +239,11 @@
#Check if forward_URL is my friend
############################################################################
if($forward_URL ne ""){
+ if($forward_URL =~ /(.*)\/$/){
+ $forward_URL = $1;
+ }
+ debug_print("loginexec.cgi: ForwardURL= $forward_URL");
+
my $passAB="";
try{
$passAB = $af->getFM->get_attribute_by_afid($forward_URL, "password");
@@ -241,7 +256,7 @@
show_askmakefriend_screen();
exit;
}else{
- $next_url= "$af->{site__web_root}/outgoing.cgi?dest_url=$forward_URL";
+ $next_url= "$af->{site__web_root}/outgoing.cgi?dest_url=$forward_URL&dest_url2=$aftergo_URL";
}
}else{
$next_url= "$af->{site__web_root}/admin.cgi";
@@ -283,7 +298,7 @@
die_on_bad_params => 0);
$tmpl->param("owner_nickname" => $af->{user__nickname});
$tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
- $tmpl->param("cgi_path" => "$af->{site__web_root}/bin/loginexec.cgi?mode=s2&forward_URL=$forward_URL");
+ $tmpl->param("cgi_path" => "$af->{site__web_root}/bin/loginexec.cgi?mode=s2&forward_URL=$forward_URL&aftergo_URL=$aftergo_URL");
$tmpl->param($args{mode} => "true");
$tmpl->param(error => $args{error});