| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function handle(): void |
||
| 26 | { |
||
| 27 | /** @var User|null $user */ |
||
| 28 | $user = User::where('is_admin', true)->first(); |
||
| 29 | |||
| 30 | if (!$user) { |
||
| 31 | $this->error('An admin account cannot be found. Have you set up Koel yet?'); |
||
| 32 | |||
| 33 | return; |
||
| 34 | } |
||
| 35 | |||
| 36 | $this->comment("Changing the default admin's password (ID: {$user->id}, email: {$user->email})"); |
||
| 37 | |||
| 38 | $user->password = $this->hash->make($this->askForPassword()); |
||
| 39 | $user->save(); |
||
| 40 | |||
| 41 | $this->comment('Alrighty, your new password has been saved. Enjoy! 👌'); |
||
| 42 | } |
||
| 44 |