1
0
AntonLV 11 жил өмнө
parent
commit
df03c4aa03

+ 2 - 1
member.php

@@ -30,8 +30,9 @@ if (isset($_POST['ID'])) { // login form is submitted
         exit;
 
     } elseif ($bLoginSuccess) {
+    	$sId = trim($oForm->getCleanValue('ID'));
 
-        $oAccount = BxDolAccount::getInstance($oForm->getCleanValue('ID'));
+        $oAccount = BxDolAccount::getInstance($sId);
         $aAccount = bx_login($oAccount->id(), ($oForm->getCleanValue('rememberMe') ? true : false));
 
         $sUrlRelocate = $oForm->getCleanValue('relocate');

+ 7 - 0
template/scripts/BxBaseFormAccount.php

@@ -36,6 +36,8 @@ class BxFormAccountCheckerHelper extends BxDolFormCheckerHelper
      */
     function checkEmailUniq ($s)
     {
+    	$s = trim($s);
+
         if (!$this->checkEmail($s))
             return false;
 
@@ -57,6 +59,7 @@ class BxFormAccountCheckerHelper extends BxDolFormCheckerHelper
  */
 class BxBaseFormAccount extends BxTemplFormView
 {
+	static $FIELD_EMAIL = 'email';
     static $FIELD_PASSWORD = 'password';
     static $FIELD_SALT = 'salt';
     static $FIELD_ADDED = 'added';
@@ -90,11 +93,15 @@ class BxBaseFormAccount extends BxTemplFormView
 
     public function insert ($aValsToAdd = array(), $isIgnore = false)
     {
+    	$sEmail = $this->getCleanValue(self::$FIELD_EMAIL);
+    	$sEmail = trim(strtolower($sEmail));
+    	
         $sPwd = $this->getCleanValue(self::$FIELD_PASSWORD);
         $sSalt = genRndSalt();
         $sPasswordHash = encryptUserPwd($sPwd, $sSalt);
 
         $aValsToAdd = array_merge($aValsToAdd, array (
+        	self::$FIELD_EMAIL => $sEmail, 
             self::$FIELD_PASSWORD => $sPasswordHash,
             self::$FIELD_SALT => $sSalt,
             self::$FIELD_ADDED => time(),

+ 4 - 1
template/scripts/BxBaseFormLogin.php

@@ -41,7 +41,10 @@ class BxBaseFormLogin extends BxTemplFormView
         if (!parent::isValid ())
             return false;
 
-        $sErrorString = bx_check_password($this->getCleanValue('ID'), $this->getCleanValue('Password'), $this->getRole());
+		$sId = trim($this->getCleanValue('ID'));
+		$sPassword = $this->getCleanValue('Password');
+
+        $sErrorString = bx_check_password($sId, $sPassword, $this->getRole());
         $this->_setCustomError ($sErrorString);
         return $sErrorString ? false : true;
     }