| Conditions | 4 | 
| Paths | 1 | 
| Total Lines | 17 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 16 | public function boot()  | 
            ||
| 17 |     { | 
            ||
| 18 | parent::boot();  | 
            ||
| 19 | |||
| 20 | // W starej wersji 4programmers.net hasla byly hashowane przy pomocy sha256 + sol. Jezeli w bazie  | 
            ||
| 21 | // danych jest stary hash, to zmieniamy hasha i zapisujemy do bazy danych  | 
            ||
| 22 |         $this->app['events']->listen(Attempting::class, function (Attempting $attempting) { | 
            ||
| 23 |             $user = User::where('name', $attempting->credentials['name'])->first(); | 
            ||
| 24 | |||
| 25 | if ($user && $user->salt  | 
            ||
| 26 |                 && $user->password === hash('sha256', $user->salt . $attempting->credentials['password'])) { | 
            ||
| 27 | $user->password = bcrypt($attempting->credentials['password']);  | 
            ||
| 28 | $user->salt = null;  | 
            ||
| 29 | $user->save();  | 
            ||
| 30 | }  | 
            ||
| 31 | });  | 
            ||
| 32 | }  | 
            ||
| 33 | }  | 
            ||
| 34 |