mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-26 15:01:54 +02:00
Fix pint issues
This commit is contained in:
parent
ad43aa777b
commit
e624995ebc
@ -131,8 +131,7 @@ class GroupController extends Controller
|
|||||||
// are not assigned to any group record.
|
// are not assigned to any group record.
|
||||||
if ($group->id === 0) {
|
if ($group->id === 0) {
|
||||||
$twofaccounts = $request->user()->twofaccounts;
|
$twofaccounts = $request->user()->twofaccounts;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$twofaccounts = $group->twofaccounts;
|
$twofaccounts = $group->twofaccounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class GroupStoreRequest extends FormRequest
|
|||||||
*
|
*
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public function messages(): array
|
public function messages() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name.not_in' => __('errors.reserved_name_please_choose_something_else'),
|
'name.not_in' => __('errors.reserved_name_please_choose_something_else'),
|
||||||
|
@ -57,7 +57,7 @@ class Helpers
|
|||||||
public static function lockedPreferences(array $preferences) : array
|
public static function lockedPreferences(array $preferences) : array
|
||||||
{
|
{
|
||||||
foreach ($preferences as $key => $value) {
|
foreach ($preferences as $key => $value) {
|
||||||
$_key = $key === 'revealDottedOTP' ? 'revealDottedOtp' : $key;
|
$_key = $key === 'revealDottedOTP' ? 'revealDottedOtp' : $key;
|
||||||
$isLocked = envUnlessEmpty(Str::of($_key)->snake('_')->upper()->prepend('USERPREF_LOCKED__')->toString(), false);
|
$isLocked = envUnlessEmpty(Str::of($_key)->snake('_')->upper()->prepend('USERPREF_LOCKED__')->toString(), false);
|
||||||
|
|
||||||
if ($isLocked) {
|
if ($isLocked) {
|
||||||
|
@ -28,7 +28,7 @@ class SinglePageController extends Controller
|
|||||||
$publicSettings = $appSettings->only([
|
$publicSettings = $appSettings->only([
|
||||||
'disableRegistration',
|
'disableRegistration',
|
||||||
'enableSso',
|
'enableSso',
|
||||||
'useSsoOnly'
|
'useSsoOnly',
|
||||||
]);
|
]);
|
||||||
$settings = $appSettings->map(function (mixed $item, string $key) {
|
$settings = $appSettings->map(function (mixed $item, string $key) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -78,7 +78,7 @@ class Group extends Model
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dispatchesEvents = [
|
protected $dispatchesEvents = [
|
||||||
'deleted' => GroupDeleted::class,
|
'deleted' => GroupDeleted::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,8 +117,7 @@ class Group extends Model
|
|||||||
$group->id = 0;
|
$group->id = 0;
|
||||||
|
|
||||||
return $group;
|
return $group;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return parent::resolveRouteBinding($value, $field);
|
return parent::resolveRouteBinding($value, $field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,16 +427,14 @@ class TwoFAccount extends Model implements Sortable
|
|||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$OtpDto = new TotpDto;
|
$OtpDto = new TotpDto;
|
||||||
$OtpDto->otp_type = $this->otp_type;
|
$OtpDto->otp_type = $this->otp_type;
|
||||||
$OtpDto->generated_at = $time ?: time();
|
$OtpDto->generated_at = $time ?: time();
|
||||||
$expires_in = $this->generator->expiresIn(); /** @phpstan-ignore-line - expiresIn() is in the TOTPInterface only */
|
$expires_in = $this->generator->expiresIn(); /** @phpstan-ignore-line - expiresIn() is in the TOTPInterface only */
|
||||||
|
|
||||||
if ($this->otp_type === self::TOTP) {
|
if ($this->otp_type === self::TOTP) {
|
||||||
$OtpDto->password = $this->generator->at($OtpDto->generated_at);
|
$OtpDto->password = $this->generator->at($OtpDto->generated_at);
|
||||||
$OtpDto->next_password = $this->generator->at($OtpDto->generated_at + $expires_in + 2);
|
$OtpDto->next_password = $this->generator->at($OtpDto->generated_at + $expires_in + 2);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$OtpDto->password = SteamTotp::getAuthCode(base64_encode(Base32::decodeUpper($this->secret)));
|
$OtpDto->password = SteamTotp::getAuthCode(base64_encode(Base32::decodeUpper($this->secret)));
|
||||||
$OtpDto->next_password = SteamTotp::getAuthCode(base64_encode(Base32::decodeUpper($this->secret)), $expires_in + 2);
|
$OtpDto->next_password = SteamTotp::getAuthCode(base64_encode(Base32::decodeUpper($this->secret)), $expires_in + 2);
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@ class UserControllerTest extends FeatureTestCase
|
|||||||
->json('GET', '/api/v1/user/preferences/showOtpAsDot')
|
->json('GET', '/api/v1/user/preferences/showOtpAsDot')
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertExactJson([
|
->assertExactJson([
|
||||||
'key' => 'showOtpAsDot',
|
'key' => 'showOtpAsDot',
|
||||||
'value' => config('2fauth.preferences.showOtpAsDot'),
|
'value' => config('2fauth.preferences.showOtpAsDot'),
|
||||||
'locked' => false,
|
'locked' => false,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -141,8 +141,8 @@ class UserControllerTest extends FeatureTestCase
|
|||||||
->json('GET', '/api/v1/user/preferences/theme')
|
->json('GET', '/api/v1/user/preferences/theme')
|
||||||
->assertOk()
|
->assertOk()
|
||||||
->assertExactJson([
|
->assertExactJson([
|
||||||
'key' => 'theme',
|
'key' => 'theme',
|
||||||
'value' => 'light',
|
'value' => 'light',
|
||||||
'locked' => true,
|
'locked' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class GroupModelTest extends ModelTestCase
|
|||||||
'user_id' => 'integer',
|
'user_id' => 'integer',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'deleted' => GroupDeleted::class,
|
'deleted' => GroupDeleted::class,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user