/** * Finds a throttling interface by the given user login. * * @param string $login * @param string $ipAddress * @return \Cartalyst\Sentry\Throttling\ThrottleInterface */ public function findByUserLogin($login, $ipAddress = null) { $user = $this->userProvider->findByLogin($login); $user_id = $user->id; $model = $this->createModel(); $query = $model->where('user_id', '=', $user_id); if ($ipAddress) { $query->where('ip_address', '=', $ipAddress); } $throttle = $query->find(); if ( ! $throttle->loaded() ) { $throttle = $this->createModel(); $throttle->user_id = $user_id; if ($ipAddress) $throttle->ip_address = $ipAddress; $throttle->save(); } return $throttle; }
/** * Finds a user by the login value. * * @param string $login * @return \Cartalyst\Sentry\Users\UserInterface * @throws \Cartalyst\Sentry\Users\UserNotFoundException */ public function findUserByLogin($login) { return $this->userProvider->findByLogin($login); }
/** * Finds a throttling interface by the given user login. * * @param string $login * @param string $ipAddress * @return \Cartalyst\Sentry\Throttling\ThrottleInterface */ public function findByUserLogin($login, $ipAddress = null) { return $this->findByUser($this->userProvider->findByLogin($login), $ipAddress); }