Skip to content

Commit cc9f533

Browse files
add verified email
1 parent 8f9f0c4 commit cc9f533

File tree

6 files changed

+26
-1
lines changed

6 files changed

+26
-1
lines changed

app/Providers/FolioServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function boot(): void
2828
->middleware([
2929
'cms/*' => [
3030
'auth',
31+
'verified',
3132
],
3233
]);
3334
}

database/seeders/UserSeeder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function run(): void
2525

2626
// Add role to the superadmin user
2727
$superadmin->assignRole('superadmin');
28+
$superadmin->markEmailAsVerified();
2829

2930
$user = User::firstOrCreate(
3031
[

resources/views/auth/verify-email.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<x-layouts.guest>
22
<x-slot:title>
3-
Reset Password
3+
Verify Email
44
</x-slot:title>
55
<div class="row">
66
<div

resources/views/livewire/.gitkeep

Whitespace-only changes.

resources/views/livewire/cms/management/user/create.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function save() {
3535
// Create a new user with the validated name
3636
$model = User::create($this->all());
3737
$model->syncRoles($this->role);
38+
$model->markEmailAsVerified();
3839
3940
// Redirect to the user index page after creation
4041
to_route('cms.management.user')->with('success', 'User created successfully.');

resources/views/livewire/cms/management/user/page.blade.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ public function delete($id) {
7272
$this->dispatch('alert', type: 'success', message: 'User deleted successfully.');
7373
}
7474
75+
#[On('verifyEmail')]
76+
public function verifyEmail($id) {
77+
$this->canDo('update.' . $this->modelInstance, false);
78+
79+
$user = User::findOrFail($id);
80+
$user->markEmailAsVerified();
81+
82+
$this->dispatch('alert', type: 'success', message: 'Email verified successfully.');
83+
}
84+
7585
// Change Password
7686
public $oldData;
7787
public string $password = '';
@@ -171,6 +181,18 @@ public function savePassword() {
171181
{{ $d->created_at->format('d F Y') }}
172182
</td>
173183
<td class="align-middle">
184+
<x-cms.action.button type="button" :permission="'update.' . $modelInstance" x-on:click="
185+
$wire.dispatch('confirm', {
186+
title: 'Verify this email?',
187+
message: '{{ $d->email }} will be verified now.',
188+
icon: 'question',
189+
function: 'verifyEmail',
190+
id: '{{ $d->id }}',
191+
})
192+
">
193+
<i class="fas fa-envelope me-2"></i>
194+
Verify Email
195+
</x-cms.action.button>
174196
<x-cms.action.button type="button" :permission="'update.' . $modelInstance" wire:click="changePassword('{{ $d->id }}')">
175197
<i class="fas fa-key me-2"></i>
176198
Change Password

0 commit comments

Comments
 (0)