public function handle(SuccessfulLogin $event) { $person = $event->getPerson(); $person->setLastFailedLogin(null); $person->setFailedLogins(0); Person::save($person); }
public function setPassword() { if ($this->request->method() === 'GET') { return $this->showForm(['token' => $this->request->input('token')]); } $person = Person::findByEmail($this->request->input('email')); if (!$person->isValid()) { return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_email'), 'token' => $this->request->input('token')]); } $tokens = $this->app['auth.password.tokens']; $token = $tokens->exists($person, $this->request->input('token')); if (!$token) { return $this->showForm(['error' => Lang::get('boomcms::recover.errors.invalid_token'), 'token' => $this->request->input('token')]); } if ($this->request->input('password1') != $this->request->input('password2')) { return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]); } if ($this->request->input('password1') && $this->request->input('password2')) { $tokens->delete($token); $tokens->deleteExpired(); $person->setEncryptedPassword($this->auth->hash($this->request->input('password1'))); Person::save($person); $this->auth->login($person); return redirect('/'); } else { return $this->showForm(['error' => Lang::get('boomcms::recover.errors.password_mismatch'), 'token' => $this->request->input('token')]); } }
public function update(Request $request, PersonModel $person) { $person->setName($request->input('name'))->setEnabled($request->has('enabled')); if (Gate::allows('editSuperuser', $person)) { $person->setSuperuser($request->has('superuser')); } PersonFacade::save($person); }
/** * @param LoginEvent $event */ public function handle(LoginEvent $event) { $person = $event->user; if ($person instanceof PersonModel && $person->getId()) { $person->setLastLogin(Carbon::now()); Person::save($person); } }
public function save() { $superuser = $this->request->input('superuser'); $this->editPerson->setName($this->request->input('name'))->setEnabled($this->request->input('enabled') == 1); if ($superuser !== null && Auth::getPerson()->isSuperuser() && Auth::getPerson()->getId() != $this->editPerson->getId()) { $this->editPerson->setSuperuser($superuser == 1); } Person::save($this->editPerson); }
public function postIndex() { $message = ''; if ($name = $this->request->input('name')) { $this->person->setName($name); } if ($this->request->input('password1') && $this->request->input('password1') != $this->request->input('current_password')) { if (!$this->person->checkPassword($this->request->input('current_password'))) { $message = 'Invalid password'; } elseif ($this->request->input('password1') != $this->request->input('password2')) { $message = 'The passwords you entered did not match'; } else { $this->person->setEncryptedPassword($this->auth->hash($this->request->input('password1'))); Event::fire(new PasswordChanged($this->person, $this->request)); $message = 'Your password has been updated'; } } Person::save($this->person); return view('boomcms::account.account', ['person' => $this->person, 'auth' => $this->auth, 'logs' => [], 'message' => $message]); }
/** * Bootstrap any application services. * * @return void */ public function boot(Request $request) { $installer = new Installer\Installer(); if (php_sapi_name() !== 'cli' && !$installer->isInstalled()) { if (!$this->app['migration.repository']->repositoryExists()) { $this->app['migration.repository']->createRepository(); } $this->app['migrator']->run(base_path('/vendor/boomcms/boom-core/src/database/migrations')); $site = $installer->saveSiteDetails($request->input('site_name'), $request->input('site_email')); $name = $request->input('user_name'); $email = $request->input('user_email'); $person = $this->dispatch(new Jobs\CreatePerson($email, $name)); $person->addSite($site); $person->setSuperuser(true); Person::save($person); auth()->login($person); $page = $this->dispatch(new Jobs\CreatePage($person, $site)); $this->dispatch(new Jobs\CreatePagePrimaryUri($page, '', '/')); $installer->markInstalled(); header('Location: /boomcms/login'); exit; } }
/** * Reset the given user's password. * * @param \Illuminate\Contracts\Auth\CanResetPassword $user * @param string $password * * @return void */ protected function resetPassword($user, $password) { $user->password = (new Hasher())->make($password); Person::save($user); auth()->login($user); }