Skip to content

Commit

Permalink
Merge pull request #15333 from filamentphp/refactor-2fa
Browse files Browse the repository at this point in the history
Refactor 2FA and allow it to be required
  • Loading branch information
danharrin authored Jan 13, 2025
2 parents 3668365 + c442ce3 commit df58760
Show file tree
Hide file tree
Showing 86 changed files with 1,785 additions and 499 deletions.
4 changes: 3 additions & 1 deletion packages/actions/resources/views/components/modals.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
style="height: 0"
>
@foreach ($this->getMountedActions() as $action)
{{ $action->toModalHtmlable() }}
@if ((! $loop->last) || $this->mountedActionShouldOpenModal())
{{ $action->toModalHtmlable() }}
@endif
@endforeach
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/forms/resources/lang/uz/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,5 +478,5 @@
],

],

];
8 changes: 4 additions & 4 deletions packages/forms/src/Components/Concerns/HasHint.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use Filament\Actions\Action;
use Filament\Forms\Components\Field;
use Filament\Forms\Components\Placeholder;
use Filament\Schemas\Components\Decorations\IconDecoration;
use Filament\Schemas\Components\Decorations\TextDecoration;
use Filament\Schemas\Components\Icon;
use Filament\Schemas\Components\Text;
use Illuminate\Contracts\Support\Htmlable;

trait HasHint
Expand Down Expand Up @@ -36,14 +36,14 @@ protected function setUpHint(): void
$hint = $component->getHint();

if (filled($hint)) {
$decorations[] = TextDecoration::make($hint)
$decorations[] = Text::make($hint)
->color($component->getHintColor());
}

$hintIcon = $component->getHintIcon();

if (filled($hintIcon)) {
$decorations[] = IconDecoration::make($hintIcon)
$decorations[] = Icon::make($hintIcon)
->tooltip($component->getHintIconTooltip());
}

Expand Down
8 changes: 4 additions & 4 deletions packages/infolists/src/Components/Concerns/HasHint.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use Closure;
use Filament\Actions\Action;
use Filament\Infolists\Components\Entry;
use Filament\Schemas\Components\Decorations\IconDecoration;
use Filament\Schemas\Components\Decorations\TextDecoration;
use Filament\Schemas\Components\Icon;
use Filament\Schemas\Components\Text;
use Illuminate\Contracts\Support\Htmlable;

trait HasHint
Expand Down Expand Up @@ -35,14 +35,14 @@ protected function setUpHint(): void
$hint = $component->getHint();

if (filled($hint)) {
$decorations[] = TextDecoration::make($hint)
$decorations[] = Text::make($hint)
->color($component->getHintColor());
}

$hintIcon = $component->getHintIcon();

if (filled($hintIcon)) {
$decorations[] = IconDecoration::make($hintIcon)
$decorations[] = Icon::make($hintIcon)
->tooltip($component->getHintIconTooltip());
}

Expand Down
72 changes: 60 additions & 12 deletions packages/infolists/src/Components/ImageEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class ImageEntry extends Entry

protected string | Closure | null $disk = null;

protected int | string | Closure | null $height = null;
protected int | string | Closure | null $imageHeight = null;

protected int | string | Closure | null $imageWidth = null;

protected bool | Closure $isCircular = false;

Expand Down Expand Up @@ -59,9 +61,37 @@ public function disk(string | Closure | null $disk): static
return $this;
}

public function imageHeight(int | string | Closure | null $height): static
{
$this->imageHeight = $height;

return $this;
}

/**
* @deprecated Use `imageHeight()` instead.
*/
public function height(int | string | Closure | null $height): static
{
$this->height = $height;
$this->imageHeight($height);

return $this;
}

public function imageSize(int | string | Closure $size): static
{
$this->imageWidth($size);
$this->imageHeight($size);

return $this;
}

/**
* @deprecated Use `imageSize()` instead.
*/
public function size(int | string | Closure $size): static
{
$this->imageSize($size);

return $this;
}
Expand All @@ -80,24 +110,26 @@ public function square(bool | Closure $condition = true): static
return $this;
}

public function size(int | string | Closure $size): static
public function visibility(string | Closure $visibility): static
{
$this->width($size);
$this->height($size);
$this->visibility = $visibility;

return $this;
}

public function visibility(string | Closure $visibility): static
public function imageWidth(int | string | Closure | null $width): static
{
$this->visibility = $visibility;
$this->imageWidth = $width;

return $this;
}

/**
* @deprecated Use `imageWidth()` instead.
*/
public function width(int | string | Closure | null $width): static
{
$this->width = $width;
$this->imageWidth($width);

return $this;
}
Expand All @@ -112,9 +144,9 @@ public function getDiskName(): string
return $this->evaluate($this->disk) ?? config('filament.default_filesystem_disk');
}

public function getHeight(): ?string
public function getImageHeight(): ?string
{
$height = $this->evaluate($this->height);
$height = $this->evaluate($this->imageHeight);

if ($height === null) {
return null;
Expand All @@ -127,6 +159,14 @@ public function getHeight(): ?string
return $height;
}

/**
* @deprecated Use `getImageHeight()` instead.
*/
public function getHeight(): ?string
{
return $this->getImageHeight();
}

public function defaultImageUrl(string | Closure | null $url): static
{
$this->defaultImageUrl = $url;
Expand Down Expand Up @@ -177,9 +217,9 @@ public function getVisibility(): string
return $this->evaluate($this->visibility);
}

public function getWidth(): ?string
public function getImageWidth(): ?string
{
$width = $this->evaluate($this->width);
$width = $this->evaluate($this->imageWidth);

if ($width === null) {
return null;
Expand All @@ -192,6 +232,14 @@ public function getWidth(): ?string
return $width;
}

/**
* @deprecated Use `getImageWidth()` instead.
*/
public function getWidth(): ?string
{
return $this->getImageWidth();
}

public function isCircular(): bool
{
return (bool) $this->evaluate($this->isCircular);
Expand Down
2 changes: 1 addition & 1 deletion packages/panels/dist/theme.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

return [

'label' => 'Remove',
'label' => 'Turn off',

'modal' => [

'heading' => 'Remove email code authentication',
'heading' => 'Disable email verification codes',

'description' => 'Are you sure you want to disable email code authentication?',
'description' => 'Are you sure you want to stop receiving email verification codes? Disabling this will remove an extra layer of security from your account.',

'form' => [

'code' => [

'label' => 'Enter the code we sent you by email',
'label' => 'Enter the 6-digit code we sent you by email',

'validation_attribute' => 'code',

Expand Down Expand Up @@ -49,7 +49,7 @@
'actions' => [

'submit' => [
'label' => 'Remove email code authentication',
'label' => 'Disable email verification codes',
],

],
Expand All @@ -58,8 +58,8 @@

'notifications' => [

'removed' => [
'title' => 'Email code authentication has been removed',
'disabled' => [
'title' => 'Email verification codes have been disabled',
],

],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

'modal' => [

'heading' => 'Set up email code authentication',
'heading' => 'Set up email verification codes',

'description' => 'You\'ll need to enter a code we send you by email each time you sign in. We\'ve sent you an email with a code to get started.',
'description' => 'You\'ll need to enter the 6-digit code we send you by email each time you sign in or perform sensitive actions. Check your email for a 6-digit code to complete the setup.',

'form' => [

'code' => [

'label' => 'Enter the code we sent you by email',
'label' => 'Enter the 6-digit code we sent you by email',

'validation_attribute' => 'code',

Expand Down Expand Up @@ -49,7 +49,7 @@
'actions' => [

'submit' => [
'label' => 'Enable email code authentication',
'label' => 'Enable email verification codes',
],

],
Expand All @@ -59,7 +59,7 @@
'notifications' => [

'enabled' => [
'title' => 'Email code authentication has been enabled',
'title' => 'Email verification codes have been enabled',
],

],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@
'management_schema' => [

'actions' => [
'label' => 'Email code authentication',

'label' => 'Email verification codes',

'below_content' => 'Receive a temporary code at your email address to verify your identity during login.',

'messages' => [
'enabled' => 'Enabled',
'disabled' => 'Disabled',
],

],

],

'login_form' => [

'label' => 'Send a code to your email',

'code' => [

'label' => 'Enter the code we sent you by email',
'label' => 'Enter the 6-digit code we sent you by email',

'validation_attribute' => 'code',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

return [

'label' => 'Remove',
'label' => 'Turn off',

'modal' => [

'heading' => 'Remove two-factor authentication app',
'heading' => 'Disable authenticator app',

'description' => 'Are you sure you want to remove two-factor authentication app?',
'description' => 'Are you sure you want to stop using the authenticator app? Disabling this will remove an extra layer of security from your account.',

'form' => [

'code' => [

'label' => 'Enter a code from the app',
'label' => 'Enter the 6-digit code from the authenticator app',

'validation_attribute' => 'code',

Expand Down Expand Up @@ -53,7 +53,7 @@
'actions' => [

'submit' => [
'label' => 'Remove two-factor authentication',
'label' => 'Disable authenticator app',
],

],
Expand All @@ -62,8 +62,8 @@

'notifications' => [

'removed' => [
'title' => 'Two-factor app authentication has been removed',
'disabled' => [
'title' => 'Authenticator app has been disabled',
],

],
Expand Down
Loading

0 comments on commit df58760

Please sign in to comment.