mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-13 23:38:32 +02:00
Add User management features to back-end
This commit is contained in:
@ -3,10 +3,12 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\WebAuthnManageCredentials;
|
||||
use Illuminate\Auth\Events\PasswordReset;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Laragear\WebAuthn\WebAuthnAuthentication;
|
||||
@ -108,6 +110,18 @@ class User extends Authenticatable implements WebAuthnAuthenticatable
|
||||
$this->is_admin = $promote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset user password with a 12 chars random string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resetPassword()
|
||||
{
|
||||
$this->password = Hash::make(Str::password(12));
|
||||
|
||||
event(new PasswordReset($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
|
Reference in New Issue
Block a user