Google2Fa ready to upload
This commit is contained in:
parent
e3495be8b8
commit
73e38a006e
127 changed files with 2637 additions and 589 deletions
29
app/User.php
29
app/User.php
|
|
@ -7,10 +7,11 @@ use App\Models\SfGuardUser;
|
|||
use App\Mail\MailResetPassword;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions\F;
|
||||
|
||||
/**
|
||||
* App\User
|
||||
|
|
@ -93,7 +94,6 @@ class User extends Authenticatable
|
|||
protected $dates = ['deleted_at'];
|
||||
protected $table = 'users';
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
|
@ -109,7 +109,7 @@ class User extends Authenticatable
|
|||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token', 'token',
|
||||
'password', 'remember_token', 'token', 'secret_key',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
|
@ -134,6 +134,20 @@ class User extends Authenticatable
|
|||
return $this->hasMany('App\Models\UserUpdateEmail', 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function isGoogle2Fa(){
|
||||
return ($this->google2fa && $this->secret_key) ? true : false;
|
||||
}
|
||||
|
||||
public function setSecretKeyAttribute($value)
|
||||
{
|
||||
$this->attributes['secret_key'] = $value ? Crypt::encryptString($value) : null;
|
||||
}
|
||||
|
||||
public function getSecretKeyAttribute($value)
|
||||
{
|
||||
return $value ? Crypt::decryptString($value) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -149,6 +163,9 @@ class User extends Authenticatable
|
|||
*/
|
||||
public function isAdmin()
|
||||
{
|
||||
if(!$this->active){
|
||||
return false;
|
||||
}
|
||||
if($this->admin >= 1){
|
||||
return true;
|
||||
}
|
||||
|
|
@ -160,6 +177,9 @@ class User extends Authenticatable
|
|||
*/
|
||||
public function isSuperAdmin()
|
||||
{
|
||||
if(!$this->active){
|
||||
return false;
|
||||
}
|
||||
if($this->admin >= 2){
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,6 +191,9 @@ class User extends Authenticatable
|
|||
*/
|
||||
public function isSySAdmin()
|
||||
{
|
||||
if(!$this->active){
|
||||
return false;
|
||||
}
|
||||
if($this->admin >= 3){
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue