Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,24 @@
"laravel/pint": "^1.27",
"mockery/mockery": "^1.5.0",
"nunomaduro/collision": "^8.0",
"orchestra/pest-plugin-testbench": "^4.1",
"orchestra/testbench": "^9.0|^10.0|^11.0",
"pestphp/pest": "^3.0|^4.0",
"pestphp/pest-plugin-laravel": "^3.0|^4.0",
"phpunit/phpunit": "^11.0|^12.0",
"spatie/laravel-passkeys": "^1.0",
"spatie/laravel-ray": "^1.26",
"spatie/laravel-typescript-transformer": "^2.3",
"spatie/typescript-transformer": "^2.2"
},
"suggest": {
"spatie/laravel-passkeys": "Allows you to use passkey authentication (^1.0 is required).",
"pragmarx/google2fa-laravel": "Allows you to use 2FA default TOTP command",
"bacon/bacon-qr-code": "Allows you to use QR codes in default TOTP command"
},
"conflict": {
"spatie/laravel-passkeys": "<1.0 || >=2.0"
},
"autoload": {
"files": [
"src/sharp_helper.php"
Expand Down
5 changes: 4 additions & 1 deletion demo/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\LaravelPasskeys\Models\Concerns\HasPasskeys;
use Spatie\LaravelPasskeys\Models\Concerns\InteractsWithPasskeys;

class User extends Authenticatable
class User extends Authenticatable implements HasPasskeys
{
use HasFactory;
use InteractsWithPasskeys;
use Notifiable;

protected $guarded = [];
Expand Down
7 changes: 4 additions & 3 deletions demo/app/Providers/DemoSharpServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ protected function configureSharp(SharpConfigBuilder $config): void
->setSharpMenu(SharpMenu::class)
->setThemeColor('#004c9b')
->setThemeLogo(logoUrl: '/img/sharp/logo.svg', logoHeight: '1rem', faviconUrl: '/img/sharp/favicon-32x32.png')
->enableImpersonation()
// ->enableImpersonation()
->enableForgottenPassword()
->setAuthCustomGuard('web')
->enable2faCustom(Demo2faNotificationHandler::class)
->enableLoginRateLimiting(maxAttempts: 3)
->when(config('demo.enable_passkeys'))->enablePasskeys()
->setLoginAttributes('email', 'password')
->setUserDisplayAttribute('name')
->setUserAvatarAttribute(fn () => auth()->user()->avatar?->thumbnail(200))
->enable2faCustom(Demo2faNotificationHandler::class)
->enableLoginRateLimiting(maxAttempts: 3)
->suggestRememberMeOnLoginForm()
->appendMessageOnLoginForm(view('sharp._login-page-message'))
->enableGlobalSearch(AppSearchEngine::class, 'Search for posts or authors...')
Expand Down
11 changes: 9 additions & 2 deletions demo/app/Sharp/Profile/ProfileSingleShow.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use App\Sharp\Profile\Commands\Activate2faCommand;
use App\Sharp\Profile\Commands\ChangePasswordCommand;
use App\Sharp\Profile\Commands\Deactivate2faCommand;
use Code16\Sharp\Auth\Passkeys\Entity\PasskeyEntity;
use Code16\Sharp\Show\Fields\SharpShowEntityListField;
use Code16\Sharp\Show\Fields\SharpShowPictureField;
use Code16\Sharp\Show\Fields\SharpShowTextField;
use Code16\Sharp\Show\Layout\ShowLayout;
Expand All @@ -25,7 +27,11 @@ protected function buildShowFields(FieldsContainer $showFields): void
)
->addField(
SharpShowPictureField::make('avatar'),
);
)
->when(config('demo.enable_passkeys'), fn () => $showFields->addField(
SharpShowEntityListField::make(PasskeyEntity::class)
->setLabel('Passkeys')
));
}

protected function buildShowLayout(ShowLayout $showLayout): void
Expand All @@ -35,7 +41,8 @@ protected function buildShowLayout(ShowLayout $showLayout): void
$section
->addColumn(6, fn (ShowLayoutColumn $column) => $column->withField('email'))
->addColumn(6, fn (ShowLayoutColumn $column) => $column->withField('avatar'));
});
})
->when(config('demo.enable_passkeys'))->addEntityListSection(PasskeyEntity::class);
}

public function buildShowConfig(): void
Expand Down
1 change: 1 addition & 0 deletions demo/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"masterminds/html5": "^2.9",
"pragmarx/google2fa": "^8.0",
"spatie/image-optimizer": "^1.7",
"spatie/laravel-passkeys": "^1.6",
"spatie/laravel-translatable": "^6.13",
"symfony/html-sanitizer": "^7.3",
"technikermathe/blade-lucide-icons": "dev-l13-compatibility",
Expand Down
Loading
Loading