2010-06-14 60 views
1

我們正在開發一款管理用戶的軟件,我需要使用Kohana 3和Auth Module構建一個應用程序。我的應用程序將只允許登錄。用戶登錄時,我不需要在密碼中追加鹽。我怎麼能這樣做? 謝謝。Kohana 3:無鹽登錄

編輯:

我知道,它錯了,但我改變了核心。現在我沒有鹽加密密碼: /kohana/modules/auth/classes/model/auth/user.php

public function login($username, $password, $remember = FALSE) 
{ 
    if (empty($password)) 
     return FALSE; 

    if (is_string($password)) 
    { 
     // Get the salt from the stored password 
     //$salt = $this->find_salt($this->password($username)); 
     // Create a hashed password using the salt from the stored password 
     //$password = $this->hash_password($password, $salt); 
     $password = sha1($password); 
    } 

    return $this->_login($username, $password, $remember); 
} 

回答

1
當然

你需要這樣做。否則您將以純文本形式存儲密碼。您沒有指定是使用文件還是使用orm系統。無論如何,沒有理由這樣做,因爲它更難以從登錄邏輯中破解salat函數,然後就這樣使用它。

+0

但是,將管理用戶的軟件不能使用像uniqid這樣的功能...看着源碼,我看到Kohana做到了這一點(http://kohanaframework.org/guide/api/Auth#hash_password) – Thomas 2010-06-14 19:59:24

+0

你是什麼意思通過「軟件」?什麼是uniqid函數? – antpaw 2010-06-14 20:00:30

+0

Software = .Net桌面應用程序 uniqid = PHP函數(http://php.net/manual/en/function.uniqid.php) – Thomas 2010-06-14 20:01:43