Ejemplo n.º 1
0
 /**
  * Set up a new demo user and log in.
  *
  * @return BackendAuth
  */
 protected function newDemoUser()
 {
     $demoManager = DemoManager::instance();
     $login = Str::quickRandom(Config::get('krisawzm.demomanager::username_length', 10));
     if (!$demoManager->copyTheme($login)) {
         return false;
     }
     $user = User::create(['email' => $login . '@' . $login . '.tld', 'login' => $login, 'password' => $login, 'password_confirmation' => $login, 'first_name' => ucfirst($login), 'last_name' => 'Demo', 'permissions' => $this->getPermissions(), 'is_activated' => true]);
     BackendAuth::login($user);
     UserCounter::instance()->inc();
     return $user;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     $demoManager = DemoManager::instance();
     // Prevent users from accessing the site while resetting.
     // Override all other routes with a custom lock page.
     if ($demoManager->locked()) {
         Route::any('', function () use($demoManager) {
             return $demoManager->renderLockPage();
         });
     }
     // Set active theme to correspond with username.
     // Changes will only be visible to this user.
     Event::listen('cms.activeTheme', function () {
         return DemoAuth::instance()->theme;
     });
 }
 /**
  * {@inheritdoc}
  */
 public function fire()
 {
     DemoManager::instance()->resetEverything();
     $this->info('Done.');
 }