disabled 2fa set up in demo mode for howdy account

This commit is contained in:
Čarodej
2022-03-29 10:49:08 +02:00
parent 9d4d1ba9aa
commit 32d4873715
2 changed files with 11 additions and 2 deletions

View File

@@ -221,5 +221,14 @@ class User extends Authenticatable implements MustVerifyEmail
// Create user directory for his files
Storage::makeDirectory("files/$user->id");
});
static::updating(function ($user) {
// Prevent to set 2fa in demo mode
if (config('vuefilemanager.is_demo') && $user->email === 'howdy@hi5ve.digital') {
$user->two_factor_secret = null;
$user->two_factor_recovery_codes = null;
}
});
}
}

View File

@@ -36,8 +36,8 @@ class UserResource extends JsonResource
'avatar' => $this->settings->avatar,
'email' => is_demo() ? obfuscate_email($this->email) : $this->email,
'role' => $this->role,
'two_factor_authentication' => $this->two_factor_secret ? true : false,
'socialite_account' => $this->password ? false : true,
'two_factor_authentication' => (bool)$this->two_factor_secret,
'socialite_account' => !(bool)$this->password,
'storage' => $this->storage,
'created_at' => format_date($this->created_at, 'd. M. Y'),
'updated_at' => format_date($this->updated_at, 'd. M. Y'),