[Affelio-cvs 923] CVS update: affelio/bin

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 12月 19日 (月) 12:10:29 JST


Index: affelio/bin/loginexec.cgi
diff -u affelio/bin/loginexec.cgi:1.13 affelio/bin/loginexec.cgi:1.14
--- affelio/bin/loginexec.cgi:1.13	Sun Dec 18 13:20:36 2005
+++ affelio/bin/loginexec.cgi	Mon Dec 19 12:10:29 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.13 2005/12/18 04:20:36 slash5234 Exp $
+# $Id: loginexec.cgi,v 1.14 2005/12/19 03:10:29 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 $submit_type = $wi->PTN_mode($q->param("submittype"));
 
 #Make farm URL in which this Affelio belongs to.
 my $farm_URL = $af->{site__web_root};
@@ -123,10 +124,23 @@
 	    ##################################
 	    #Format adjustment of AffelioURL
 	    ##################################
-	    $affelio_url =~ s|/$||;    #remove / at the end of line
+	    $affelio_url =~ /^([A-Za-z0-9\-\_]*)$/;
+	    if ($1 eq $affelio_url){
+		$affelio_url = $farm_URL . $affelio_url;
+	    }
+
 	    if($affelio_url !~ /^(http:\/\/)/){
 		$affelio_url = "http://" . $affelio_url;
 	    }
+	    if($affelio_url =~ /(.*)\/$/){
+		$affelio_url = $1;
+	    }
+	    debug_print("loginexec.cgi($mode): formated Affelio URL= [$affelio_url]");
+
+	    if($affelio_url eq $af->{site__web_root}){
+		show_checkpassword_screen(mode => "login_as_owner");
+		exit(1);
+	    }
 	    
 	    ##################################
 	    #Determine forward_URL
@@ -160,18 +174,36 @@
 	#####################################################################
 	#Phase S2 (V2 protocol)
 	#(auth check phase)
+	debug_print("loginexec.cgi($mode): submit_type= $submit_type");
+	if($submit_type eq "Cancel"){
+	    if($forward_URL eq ""){
+		print $q->redirect( -url => $af->{site__web_root});
+		exit;
+	    }else{
+		print $q->redirect( -url => $forward_URL);
+		exit;
+	    } 
+
+	}
+
 	if(  (verify_password($password, $af->{site__password}) > 0) ){
 	    debug_print("loginexec.cgi: AUTH Ok.\n");
 	}else{
 	    #login failed.
 	    debug_print("loginexec.cgi: AUTH NG.\n");
-	    
-	    my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/loginfailed.tmpl";
-	    my $tmpl = new HTML::Template( filename => $TMPL_FILE);
-	    $tmpl->param("tmpl_path" => "$af->{site__web_root}/templates/$af->{site__template}");
-	    $tmpl->param("forward_URL" => $forward_URL);
-	    print "Content-type: text/html; charset=UTF-8\n\n";
-	    print $af->translate_templateL10N($tmpl->output);
+
+	    my $loginfailed=
+		$af->translate_templateL10N('<AF_M text="Login failed.">');
+
+	    if($affelio_url eq $af->{site__username}){
+		sleep(3);
+		show_checkpassword_screen(mode => "login_as_owner",
+					  error => $loginfailed);
+	    }else{
+		sleep(3);
+		show_checkpassword_screen(mode => "back_from_friend",
+					  error => $loginfailed);
+	    }
 	    
 	    debug_print("loginexec.cgi: exit(1).\n");    
 	    exit(1);
@@ -196,27 +228,21 @@
 ############################################################################
 #Check if forward_URL is my friend
 ############################################################################
-my $passAB="";
-try{
-   $passAB = $af->getFM->get_attribute_by_afid($forward_URL, "password");
-}catch Error with{
-    my $e = shift;
-    error($q, "Error from FriendManager.\n" . $e);
-};
-
-if($passAB eq ""){
-    show_askmakefriend_screen();
-    exit;
-}
-
-
-
-############################################################################
-#Output
-############################################################################
-
 if($forward_URL ne ""){
-    $next_url= "$af->{site__web_root}/outgoing.cgi?dest_url=$forward_URL"; 
+    my $passAB="";
+    try{
+	$passAB = $af->getFM->get_attribute_by_afid($forward_URL, "password");
+    }catch Error with{
+	my $e = shift;
+	error($q, "Error from FriendManager.\n" . $e);
+    };
+
+    if($passAB eq ""){
+	show_askmakefriend_screen();
+	exit;
+    }else{
+	$next_url= "$af->{site__web_root}/outgoing.cgi?dest_url=$forward_URL"; 
+    }
 }else{
     $next_url= "$af->{site__web_root}/admin.cgi";
 }
@@ -231,6 +257,10 @@
 
 
 
+
+
+
+############################################################################
 sub show_askmakefriend_screen{
     my $TMPL_FILE = "$af->{site__fs_root}/templates/$af->{site__template}/owner_side/ask_makefriend.tmpl";
     my $tmpl = new HTML::Template( filename => $TMPL_FILE,
@@ -255,6 +285,7 @@
     $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($args{mode} => "true");
+    $tmpl->param(error => $args{error});
 
     print "Content-type: text/html; charset=UTF-8\n\n";
     print $af->translate_templateL10N($tmpl->output);


Affelio-cvs メーリングリストの案内
Back to archive index