Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('SYSPATH') or die('No direct access allowed.');
- /**
- * Default auth user
- *
- * @package Kohana/Auth
- * @author Kohana Team
- * @copyright (c) 2007-2011 Kohana Team
- * @license http://kohanaframework.org/license
- */
- class Model_User extends AutoModeler_ORM {
- /**
- * A user has many tokens and roles
- *
- * @var array Relationhips
- */
- protected $_has_many = array(
- 'user_tokens' => array('model' => 'user_token'),
- 'roles' => array('model' => 'role', 'through' => 'roles_users'),
- );
- protected $_table_name = 'users';
- protected $_data = array('id' => '',
- 'username' => '',
- 'password' => '',
- 'email' => '',
- 'last_login' => '',
- 'logins' => '');
- protected $_rules = array(
- 'username' => array(
- array('not_empty'),
- ),
- 'email' => array(
- array('email'),
- )
- );
- /**
- * overload __set() to hash a password
- *
- * @return string
- */
- public function __set($key, $value)
- {
- if ($key == 'password')
- {
- $this->_data[$key] = sha1($value);
- return;
- }
- return parent::__set($key, $value);
- }
- } // End User Model User Model
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement