/** * Factory method for return instance of current class * @return User */ static function factory() { if (self::$_instance == NULL) { self::$_instance = new user(); } return self::$_instance; }
/** * Authenticate a user based on its credentials * @name login * @type method * @access public * @param string email address * @param string password * @param bool autologin [default true] * @returns string usertracker code (or bool false on error) * @syntax string BreedUser->login( string email, string password [, bool autologin ] ); */ public function login($email, $password, $useAutoLogin = true) { return parent::login($email, $this->_passwordHash($password), $useAutoLogin); }
public function __construct(\Core\Application $application) { if ($application->passport && $application->passport->is_auth()) { self::$userID = $application->passport->getUserID(); } }
public function run() { DB::table('core_users')->delete(); CoreUser::setHasher(new Cartalyst\Sentry\Hashing\NativeHasher()); CoreUser::create(array('email' => '*****@*****.**', 'password' => Hash::make('secret'), 'first_name' => 'Daniel', 'last_name' => 'Wu')); }
public function addUser($id) { //user to be added to a role $user = CoreUser::find($id); $roles = $user->role_ids; $thisRoleId = array($this->id); $newRoleIds = $thisRoleId; //check if this role already exist in user's roles if (is_array($roles)) { $newRoleIds = array_merge($roles, $thisRoleId); } $user->role_ids = $newRoleIds; $user->save(); $users = $this->user_ids; $userId = array($id); $newUserIds = $userId; //check if this user already exist in role's users if (is_array($users)) { $newUserIds = array_merge($users, $userId); } $this->user_ids = $newUserIds; $this->save(); return true; }