Пример #1
0
 protected function _before()
 {
     $this->user = User::where('name', 'admin')->first();
     $fake = Factory::create();
     $password = bcrypt('password');
     $this->author = User::create(['name' => $fake->userName, 'email' => $fake->email, 'password' => $password]);
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     // W starej wersji 4programmers.net hasla byly hashowane przy pomocy sha256 + sol. Jezeli w bazie
     // danych jest stary hash, to zmieniamy hasha i zapisujemy do bazy danych
     $events->listen('auth.attempt', function ($credentials) {
         $user = User::where('name', $credentials['name'])->first();
         if ($user && $user->salt && $user->password === hash('sha256', $user->salt . $credentials['password'])) {
             $user->password = bcrypt($credentials['password']);
             $user->salt = null;
             $user->save();
         }
     });
 }
Пример #3
0
 public function testSettingsDefault()
 {
     $user = User::where('name', 'admin')->first();
     $this->assertEquals('Lorem ipsum', $user->getSetting('non existing setting', 'Lorem ipsum'));
 }
Пример #4
0
 protected function _before()
 {
     $this->user = User::where('name', 'admin')->first();
 }