mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 01:38:49 -05:00
cd4ff608ac
Co-authored-by: Roardom <78790963+Roardom@users.noreply.github.com>
33 lines
781 B
PHP
33 lines
781 B
PHP
<?php
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
use Livewire\Component;
|
|
use ZxcvbnPhp\Zxcvbn;
|
|
|
|
class PasswordStrength extends Component
|
|
{
|
|
public string $password = '';
|
|
|
|
public string $passwordStrength = 'Weak';
|
|
|
|
public int $strengthScore = 0;
|
|
|
|
public array $strengthLevels = [
|
|
1 => 'Weak',
|
|
2 => 'Fair',
|
|
3 => 'Good',
|
|
4 => 'Strong',
|
|
];
|
|
|
|
final public function updatedPassword($password): void
|
|
{
|
|
$this->strengthScore = (new Zxcvbn())->passwordStrength($password)['score'];
|
|
}
|
|
|
|
final public function render(): \Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\Foundation\Application
|
|
{
|
|
return view('livewire.password-strength');
|
|
}
|
|
}
|