Dotclear

Changeset 3036:7ed4286c8013


Ignore:
Timestamp:
07/03/15 17:03:26 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Centralizes crypt function of pwd in class.Dotclear.auth.php, closes #1923

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • admin/auth.php

    r2852 r3036  
    204204 
    205205     $cookie_admin = http::browserUID(DC_MASTER_KEY.$user_id. 
    206           crypt::hmac(DC_MASTER_KEY,$user_pwd)).bin2hex(pack('a32',$user_id)); 
     206          $core->auth->crypt($user_pwd)).bin2hex(pack('a32',$user_id)); 
    207207 
    208208     if ($check_perms && $core->auth->mustChangePassword()) 
  • admin/blog_del.php

    r2852 r3036  
    3737if (!$core->error->flag() && $blog_id && !empty($_POST['del'])) 
    3838{ 
    39      if (!$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['pwd']))) { 
     39     if (!$core->auth->checkPassword($core->auth->crypt($_POST['pwd']))) { 
    4040          $core->error->add(__('Password verification failed')); 
    4141     } else { 
  • admin/install/index.php

    r2792 r3036  
    119119          $cur->user_id = $u_login; 
    120120          $cur->user_super = 1; 
    121           $cur->user_pwd = crypt::hmac(DC_MASTER_KEY,$u_pwd); 
     121          $cur->user_pwd = $core->auth->crypt($u_pwd); 
    122122          $cur->user_name = (string) $u_name; 
    123123          $cur->user_firstname = (string) $u_firstname; 
  • admin/langs.php

    r2852 r3036  
    6363     try 
    6464     { 
    65           if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) { 
     65          if (empty($_POST['your_pwd']) || !$core->auth->checkPassword($core->auth->crypt($_POST['your_pwd']))) { 
    6666               throw new Exception(__('Password verification failed')); 
    6767          } 
     
    106106     try 
    107107     { 
    108           if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) { 
     108          if (empty($_POST['your_pwd']) || !$core->auth->checkPassword($core->auth->crypt($_POST['your_pwd']))) { 
    109109               throw new Exception(__('Password verification failed')); 
    110110          } 
  • admin/preferences.php

    r3003 r3036  
    102102     try 
    103103     { 
    104           $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd'])); 
     104          $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword($core->auth->crypt($_POST['cur_pwd'])); 
    105105 
    106106          if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { 
  • admin/user.php

    r2852 r3036  
    7272     try 
    7373     { 
    74           if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) { 
     74          if (empty($_POST['your_pwd']) || !$core->auth->checkPassword($core->auth->crypt($_POST['your_pwd']))) { 
    7575               throw new Exception(__('Password verification failed')); 
    7676          } 
  • admin/users_actions.php

    r2720 r3036  
    9797          try 
    9898          { 
    99                if (empty($_POST['your_pwd']) || !$core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) { 
     99               if (empty($_POST['your_pwd']) || !$core->auth->checkPassword($core->auth->crypt($_POST['your_pwd']))) { 
    100100                    throw new Exception(__('Password verification failed')); 
    101101               } 
  • inc/admin/lib.moduleslist.php

    r3007 r3036  
    11721172               || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 
    11731173          { 
    1174                if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY, $_POST['your_pwd']))) { 
     1174               if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword($this->core->auth->crypt($_POST['your_pwd']))) { 
    11751175                    throw new Exception(__('Password verification failed')); 
    11761176               } 
     
    19471947               || !empty($_POST['fetch_pkg']) && !empty($_POST['pkg_url'])) 
    19481948          { 
    1949                if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY, $_POST['your_pwd']))) { 
     1949               if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword($this->core->auth->crypt($_POST['your_pwd']))) { 
    19501950                    throw new Exception(__('Password verification failed')); 
    19511951               } 
  • inc/core/class.dc.auth.php

    r2566 r3036  
    121121          if ($pwd != '') 
    122122          { 
    123                if (crypt::hmac(DC_MASTER_KEY,$pwd) != $rs->user_pwd) { 
     123               if ($this->crypt($pwd) != $rs->user_pwd) { 
    124124                    sleep(rand(2,5)); 
    125125                    return false; 
     
    165165 
    166166     /** 
     167      * This method crypt given string (password, session_id, …). 
     168      * 
     169      * @param string $pwd string to be crypted 
     170      * @return string crypted value 
     171      */ 
     172     public function crypt($pwd) 
     173     { 
     174          return crypt::hmac(DC_MASTER_KEY,$pwd); 
     175     } 
     176 
     177     /** 
    167178     * This method only check current user password. 
    168179     * 
     
    290301          $code = 
    291302          pack('a32',$this->userID()). 
    292           pack('H*',crypt::hmac(DC_MASTER_KEY,$this->getInfo('user_pwd'))); 
     303          pack('H*',$this->crypt($this->getInfo('user_pwd'))); 
    293304          return bin2hex($code); 
    294305     } 
     
    317328          } 
    318329 
    319           if (crypt::hmac(DC_MASTER_KEY,$rs->user_pwd) != $pwd) { 
     330          if ($this->crypt($rs->user_pwd) != $pwd) { 
    320331               return false; 
    321332          } 
     
    594605 
    595606          $cur = $this->con->openCursor($this->user_table); 
    596           $cur->user_pwd = crypt::hmac(DC_MASTER_KEY,$new_pass); 
     607          $cur->user_pwd = $this->crypt($new_pass); 
    597608          $cur->user_recover_key = null; 
    598609 
  • inc/core/class.dc.core.php

    r3030 r3036  
    186186     public function getNonce() 
    187187     { 
    188           return crypt::hmac(DC_MASTER_KEY,session_id()); 
     188          return $this->auth->crypt(session_id()); 
    189189     } 
    190190 
     
    195195          } 
    196196 
    197           return $secret == crypt::hmac(DC_MASTER_KEY,session_id()); 
     197          return $secret == $this->auth->crypt(session_id()); 
    198198     } 
    199199 
     
    847847                    throw new Exception(__('Password must contain at least 6 characters.')); 
    848848               } 
    849                $cur->user_pwd = crypt::hmac(DC_MASTER_KEY,$cur->user_pwd); 
     849               $cur->user_pwd = $this->auth->crypt($cur->user_pwd); 
    850850          } 
    851851 
  • plugins/antispam/inc/lib.dc.antispam.php

    r2823 r3036  
    134134          $code = 
    135135          pack('a32',$core->auth->userID()). 
    136           pack('H*',crypt::hmac(DC_MASTER_KEY,$core->auth->getInfo('user_pwd'))); 
     136          pack('H*',$core->auth->crypt($core->auth->getInfo('user_pwd'))); 
    137137          return bin2hex($code); 
    138138     } 
     
    161161          } 
    162162 
    163           if (crypt::hmac(DC_MASTER_KEY,$rs->user_pwd) != $pwd) { 
     163          if ($core->auth->crypt($rs->user_pwd) != $pwd) { 
    164164               return false; 
    165165          } 
  • plugins/importExport/inc/class.dc.import.flat.php

    r2485 r3036  
    9090          if ($full_upl !== null && $this->core->auth->isSuperAdmin()) 
    9191          { 
    92                if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['your_pwd']))) { 
     92               if (empty($_POST['your_pwd']) || !$this->core->auth->checkPassword($this->core->auth->crypt($_POST['your_pwd']))) { 
    9393                    throw new Exception(__('Password verification failed')); 
    9494               } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map