\ No newline at end of file
diff --git a/resources/views/components/progress.blade.php b/resources/views/components/progress.blade.php
new file mode 100644
index 0000000000..9ff2ca8f8a
--- /dev/null
+++ b/resources/views/components/progress.blade.php
@@ -0,0 +1,10 @@
+@props([
+ 'max' => 100,
+ 'progress',
+])
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/livewire/account.blade.php b/resources/views/livewire/account.blade.php
index ed3022ce1d..158011a0fe 100644
--- a/resources/views/livewire/account.blade.php
+++ b/resources/views/livewire/account.blade.php
@@ -7,16 +7,11 @@
-
-
-
-
+
+
{{ __('Optional') }}
-
- {{ __('Your user avatar photo.') }}
-
diff --git a/resources/views/livewire/auth/login.blade.php b/resources/views/livewire/auth/login.blade.php
index e502d47b34..bb91a7f4a2 100644
--- a/resources/views/livewire/auth/login.blade.php
+++ b/resources/views/livewire/auth/login.blade.php
@@ -3,7 +3,7 @@
@if (Route::has('filament.register'))
-
+
{{ __('filament::auth.register') }}
@@ -12,7 +12,7 @@
-
+
{{ __('Forgot Your Password?') }}
diff --git a/resources/views/livewire/profile.blade.php b/resources/views/livewire/profile.blade.php
index e664fe69ec..5912665d63 100644
--- a/resources/views/livewire/profile.blade.php
+++ b/resources/views/livewire/profile.blade.php
@@ -3,18 +3,8 @@
{{ __('Account') }}
- @if (Filament\Features::hasPermissions())
-
- {{ __('Permissions') }}
-
- @endif
- @if (Filament\Features::hasPermissions())
-
- Permissions...
-
- @endif
\ No newline at end of file
diff --git a/src/Features.php b/src/Features.php
index c5e4e1d336..f3b10835ed 100644
--- a/src/Features.php
+++ b/src/Features.php
@@ -45,16 +45,6 @@ class Features
return static::enabled(static::resources());
}
- /**
- * Determine if the application has user permissions.
- *
- * @return bool
- */
- public static function hasPermissions()
- {
- return static::enabled(static::permissions());
- }
-
/**
* Enable the user registration feature.
*
@@ -75,16 +65,6 @@ class Features
return 'profile';
}
- /**
- * Enable the user permissions feature.
- *
- * @return string
- */
- public static function permissions()
- {
- return 'permissions';
- }
-
/**
* Enable the resources feature.
*
diff --git a/src/Http/Livewire/Account.php b/src/Http/Livewire/Account.php
index 9b1de1e079..f5c71cd03c 100644
--- a/src/Http/Livewire/Account.php
+++ b/src/Http/Livewire/Account.php
@@ -5,7 +5,11 @@ namespace Filament\Http\Livewire;
use Livewire\Component;
use Livewire\WithFileUploads;
use Illuminate\Validation\Rule;
-use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Str;
+use Illuminate\Support\Facades\{
+ Hash,
+ Storage,
+};
class Account extends Component
{
@@ -22,7 +26,6 @@ class Account extends Component
'required',
'email',
],
- 'avatar' => 'nullable|image|max:20',
'password' => 'nullable',
];
@@ -39,12 +42,39 @@ class Account extends Component
]);
}
+ public function updatedAvatar($value)
+ {
+ $extension = pathinfo($value->getFilename(), PATHINFO_EXTENSION);
+ if (!in_array($extension, ['png', 'jpeg', 'bmp', 'gif'])) {
+ $this->reset('avatar');
+ }
+
+ $this->validate([
+ 'avatar' => 'mimes:png,jpeg,bmp,gif|max:512', // .5MB Max
+ ]);
+ }
+
+ public function deleteAvatar()
+ {
+ $avatar = $this->user->avatar;
+
+ if ($avatar) {
+ Storage::disk(config('filament.storage_disk'))->delete($avatar);
+ $this->avatar = null;
+
+ $this->user->avatar = null;
+ $this->user->save();
+
+ $this->dispatchBrowserEvent('notify', __('Avatar removed for :name', ['name' => $this->user->name]));
+ }
+ }
+
public function submit()
{
$this->validate();
if ($this->avatar) {
- dd($this->avatar);
+ $this->user->avatar = $this->avatar->store('avatars', config('filament.storage_disk'));
}
if ($this->password) {
diff --git a/src/Http/Livewire/Auth/Login.php b/src/Http/Livewire/Auth/Login.php
index 3d00283226..be2f1670ff 100644
--- a/src/Http/Livewire/Auth/Login.php
+++ b/src/Http/Livewire/Auth/Login.php
@@ -24,6 +24,10 @@ class Login extends Component
public function mount()
{
+ if (Auth::check()) {
+ return redirect()->to(Filament::home());
+ }
+
$this->message = session('message');
}
diff --git a/src/Providers/RouteServiceProvider.php b/src/Providers/RouteServiceProvider.php
index e3e47ba02c..b1a726d899 100644
--- a/src/Providers/RouteServiceProvider.php
+++ b/src/Providers/RouteServiceProvider.php
@@ -15,15 +15,14 @@ class RouteServiceProvider extends ServiceProvider
parent::boot();
}
- protected function prefix()
- {
- return config('filament.prefix.route');
- }
-
public function map(): void
{
$this->mapWebRoutes();
- $this->mapAliasRoutes();
+ }
+
+ protected function prefix()
+ {
+ return config('filament.prefix.route');
}
protected function mapWebRoutes(): void
@@ -35,13 +34,4 @@ class RouteServiceProvider extends ServiceProvider
->group(__DIR__.'/../../routes/web.php');
}
}
-
- protected function mapAliasRoutes(): void
- {
- if (!Route::has('login')) {
- Route::get('/login', function () {
- return redirect()->route('filament.login');
- })->name('login');
- }
- }
}
\ No newline at end of file
diff --git a/tests/Feature/LoginTest.php b/tests/Feature/LoginTest.php
index f604e4cc26..e8dedd9cc9 100644
--- a/tests/Feature/LoginTest.php
+++ b/tests/Feature/LoginTest.php
@@ -31,6 +31,14 @@ class LoginTest extends TestCase
$this->assertAuthenticated();
}
+ public function test_redirect_if_logged_in()
+ {
+ $user = User::factory()->create();
+ Livewire::actingAs($user)
+ ->test(Login::class)
+ ->assertRedirect(Filament::home());
+ }
+
public function test_email_is_required()
{
Livewire::test(Login::class)