Index: trunk/kernel/frontaction.php
===================================================================
diff -u -r1381 -r1566
--- trunk/kernel/frontaction.php	(.../frontaction.php)	(revision 1381)
+++ trunk/kernel/frontaction.php	(.../frontaction.php)	(revision 1566)
@@ -41,6 +41,17 @@
 	               			$dest = GetVar('dest', true);
 	               			if(!$dest) $dest = GetVar('DestTemplate', true);
 	               			if($dest) $var_list['t'] = $dest;
+	               			
+	               			$next_template = $objSession->GetVariable('next_template');
+	               			if($next_template)
+	               			{
+	               				$objSession->SetVariable('next_template','');
+	               				$var_list_update["t"] = $next_template;
+    							$url = GetIndexURL(2)."?env=".BuildEnv();
+	               				header('Location: '.$url);
+    							exit;
+	               				$var_list['t'] = $next_template.'.tpl';
+	               			}
         			}
         			else
         			{
@@ -490,8 +501,23 @@
                  }
 
                  if ($doLoginNow)
-                 	$objSession->Login($_POST["username"], md5($password));
-                 
+                 {
+                 	$login_ok = $objSession->Login($_POST["username"], md5($password));
+                 	if($login_ok)
+                 	{
+                 		$next_template = $objSession->GetVariable('next_template');
+               			if($next_template)
+               			{
+               				$objSession->SetVariable('next_template','');
+               				$var_list_update["t"] = $next_template;
+							$url = GetIndexURL(2)."?env=".BuildEnv();
+               				header('Location: '.$url);
+							exit;
+               				$var_list['t'] = $next_template.'.tpl';
+               			}
+                 		
+                 	}
+                 }
                } 
              }             
          }         
@@ -544,6 +570,17 @@
 	             $FormError["m_acctinfo"]["password"] = language("lu_ferror_pswd_tooshort");         	
 	         }
          }
+         
+         $db =& GetADODBConnection();
+         $email = GetVar('email');
+         $test_id = $db->GetOne('SELECT PortalUserId FROM '.GetTablePrefix().'PortalUser WHERE Email = '.$db->qstr($email));
+         if($test_id && ($test_id != $objSession->Get('PortalUserId')) )
+         {
+         	$MissingCount++;
+	        $FormError["m_acctinfo"]["email"] = language("lu_ferror_email_duplicate");         	
+         }
+         
+         
          if(!$MissingCount)
          {
              /* save profile */
@@ -911,8 +948,9 @@
      	
      	if ($_GET['type']) 
      	{
-     		$modules = Array(1 => 'In-Portal', 2 => 'In-News',
-     							3 => 'In-Bulletin', 4 => 'In-Link');
+     		$modules = Array(	1 => 'In-Portal',	2 => 'In-News',
+     							3 => 'In-Bulletin',	4 => 'In-Link', 
+     							11 => 'In-Commerce');
      		$module = $modules[$_GET["type"]];
      	}
      	else