Updated to work with KH 3.1
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* This class overrides Kohana's Auth so that we can login to TSM
|
||||
*
|
||||
* @package PTA
|
||||
* @package PTA/Modifications
|
||||
* @subpackage Auth
|
||||
* @category Overrides
|
||||
* @author Deon George
|
||||
@@ -11,19 +11,16 @@
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Auth_ORM extends Kohana_Auth_ORM {
|
||||
/**
|
||||
* Attempt to log in a user by using an ORM object and plain-text password.
|
||||
*
|
||||
* @param string username to log in
|
||||
* @param string password to check against
|
||||
* @param boolean enable autologin
|
||||
* @return boolean
|
||||
*/
|
||||
public function login($username, $password, $remember = FALSE) {
|
||||
// With TSM, if we get this far, we are logged in
|
||||
return $username->loaded();
|
||||
// Override Kohana Auth requirement to have a hash_key
|
||||
public function hash($str) {
|
||||
switch ($this->_config['hash_method']) {
|
||||
case '' : return $str;
|
||||
case 'md5': return md5($str);
|
||||
default: return hash_hmac($this->_config['hash_method'], $str, $this->_config['hash_key']);
|
||||
}
|
||||
}
|
||||
|
||||
// Override Kohana logged_in() - if we can get the user, we are logged in.
|
||||
public function logged_in($role = NULL, $all_required = TRUE) {
|
||||
return FALSE !== $this->get_user();
|
||||
}
|
||||
|
Reference in New Issue
Block a user