Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysLees committed Sep 11, 2023
1 parent 532b1ff commit e689980
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 12 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,17 @@ return [
*/
'toast_fade_time_in_milliseconds' => 5000,

/*
/*
|--------------------------------------------------------------------------
| Password Reset Settings
|--------------------------------------------------------------------------
| By default, the package will use the password_resets table.
| You may define a different table name here.
|
*/
'password_reset_table' => 'password_resets',

/*
|--------------------------------------------------------------------------
| Provider Settings
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -335,8 +345,7 @@ You can publish the translations using:
php artisan vendor:publish --tag=auth-translations
```

This package uses [Laravel Honeypot](https://github.com/spatie/laravel-honeypot) to prevent spam.
Check out the [documentation](https://github.com/spatie/laravel-honeypot#readme) to learn how to customise it.
This package uses [Laravel Honeypot](https://github.com/spatie/laravel-honeypot) to prevent spam.Check out the [documentation](https://github.com/spatie/laravel-honeypot#readme) to learn how to customise it.

```bash

Expand Down
11 changes: 11 additions & 0 deletions config/laravel-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@
*/
'toast_fade_time_in_milliseconds' => 5000,


/*
|--------------------------------------------------------------------------
| Password Reset Settings
|--------------------------------------------------------------------------
| By default, the package will use the password_resets table.
| You may define a different table name here.
|
*/
'password_reset_table' => 'password_resets',

/*
|--------------------------------------------------------------------------
| Provider Settings
Expand Down
2 changes: 1 addition & 1 deletion resources/dist/authcss.css

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions resources/views/components/flash-message.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['message'])
@props(['message', 'status'])

<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, {{ config('laravel-auth.toast_fade_time_in_milliseconds') }})"
x-transition:enter="transform ease-out duration-3000 transition"
Expand All @@ -13,7 +13,16 @@
<div class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5">
<div class="p-4">
<div class="flex items-center">
<div class="flex w-0 flex-1 justify-between">
<div class="flex w-0 flex-1 justify-between items-center">
@if($status == 'success')
<svg class="w-4 h-4 text-green-500 mr-2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd"/>
</svg>
@else
<svg class="w-4 h-4 text-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zm-1.72 6.97a.75.75 0 10-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 101.06 1.06L12 13.06l1.72 1.72a.75.75 0 101.06-1.06L13.06 12l1.72-1.72a.75.75 0 10-1.06-1.06L12 10.94l-1.72-1.72z" clip-rule="evenodd"/>
</svg>
@endif
<p class="w-0 flex-1 text-sm font-medium text-gray-900">{{ $message }}</p>
</div>
<div class="ml-4 flex flex-shrink-0">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/footer.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<footer class="bg-white">
<footer>
<div class="mx-auto max-w-7xl overflow-hidden py-20 px-6 sm:py-24 lg:px-8 space-y-4">

<p class="text-center text-xs leading-5 text-gray-500">&copy; {{ date('Y') }} {{ config('app.name') }}.
Expand Down
5 changes: 2 additions & 3 deletions resources/views/components/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body class="font-sans antialiased h-full">

@if (flash()->message)
<x-auth::flash-message :message="flash()->message"/>
<x-auth::flash-message :status="flash()->class" :message="flash()->message"/>
@endif

<main>
Expand All @@ -27,10 +27,9 @@

{{ $slot }}

<x-auth::footer/>
</div>
</div>
</main>

<x-auth::footer/>
</body>
</html>
6 changes: 4 additions & 2 deletions src/Jobs/RequestPasswordJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ protected function processRequest(): void
->where('email', $this->email)
->sole();

DB::table('password_resets')->where('email', $this->email)->delete();
$table = config('laravel-auth.password_reset_table', 'password_resets');

DB::table($table)->where('email', $this->email)->delete();

$token = hash_hmac('sha256', Str::random(40), config('app.key'));

DB::table('password_resets')->insert([
DB::table($table)->insert([
'email' => $this->email,
'token' => $token,
'created_at' => now(),
Expand Down

0 comments on commit e689980

Please sign in to comment.