#84 - cr fix
This commit is contained in:
parent
4c23b1c188
commit
7473f7aaf1
@ -4,20 +4,24 @@ declare(strict_types=1);
|
||||
|
||||
namespace Toby\Eloquent\Observers;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Illuminate\Support\Str;
|
||||
use Toby\Eloquent\Models\User;
|
||||
use Toby\Eloquent\Models\YearPeriod;
|
||||
|
||||
class UserObserver
|
||||
{
|
||||
public function __construct(
|
||||
protected Hasher $hash,
|
||||
) {}
|
||||
|
||||
public function creating(User $user): void
|
||||
{
|
||||
/**
|
||||
* A random password for user is generated because AuthenticateSession middleware needs a user's password
|
||||
* for some checks. Users use Google to login, so they don't need to know the password (GitHub issue #84)
|
||||
*/
|
||||
$user->password = Hash::make(Str::random(40));
|
||||
$user->password = $this->hash->make(Str::random(40));
|
||||
}
|
||||
|
||||
public function created(User $user): void
|
||||
|
Loading…
x
Reference in New Issue
Block a user