public function deletePerson($personID) { if ($personID > 1) { if (is_null(\Sentinel::getUserProvider()->getById($personID)->select('id')->value('id'))) { $this->createModel()->newQuery()->where('person_id', $personID)->delete(); } else { throw new PersonHasAUserAccountException(); } } else { throw new \UnexpectedValueException('Wrong data for person deletion.'); } }
/** * Handle a login request to the application. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function login(Request $request) { $this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']); // If the class is using the ThrottlesLogins trait, we can automatically throttle // the login attempts for this application. We'll key this by the username and // the IP address of the client making these requests into this application. $throttles = $this->isUsingThrottlesLoginsTrait(); if ($throttles && $this->hasTooManyLoginAttempts($request)) { return $this->sendLockoutResponse($request); } $credentials = $this->getCredentials($request); $isActivated = \Sentinel::getUserProvider()->isActivated($request->get('email')); if (!is_null($isActivated)) { if ($isActivated != 1) { return redirect()->back()->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => trans('error.auth.not_activated')]); } } if (\Auth::attempt($credentials, $request->has('remember'))) { return $this->handleUserWasAuthenticated($request, $throttles); } // If the login attempt was unsuccessful we will increment the number of attempts // to login and redirect the user back to the login form. Of course, when this // user surpasses their maximum number of attempts they will get locked out. if ($throttles) { $this->incrementLoginAttempts($request); } return redirect()->back()->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]); }
public function handle($userID) { Sentinel::getUserProvider()->updateLastLoginTimestamp($userID); }
public function index() { $userCount = \Sentinel::getUserProvider()->getAllUsersCount(); $groupCount = \Sentinel::getGroupProvider()->getAllGroupsCount(); return view('admin.dashboard', compact('userCount', 'groupCount')); }