statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.73k stars 514 forks source link

Password reset not working for Eloquent users #6713

Closed byron-roots closed 2 years ago

byron-roots commented 2 years ago

Bug description

I've recently updated one of our sites to use eloquent users. We just tested out the Password Reset functionality and we've run into some issues. We just followed the instructions in the docs to set this all up.

Initially the password_resets table wasn't there, which is missing from the StatamicAuthTables migration. We manually added the table in, using the default laravel migration, but now the password.reset route is not found.

config/statamic/users.php

return [
    'repository' => 'eloquent',

    'repositories' => [

        'file' => [
            'driver' => 'file',
            'paths' => [
                'users' => base_path('users'),
                'roles' => resource_path('users/roles.yaml'),
                'groups' => resource_path('users/groups.yaml'),
            ],
        ],

        'eloquent' => [
            'driver' => 'eloquent',
        ],

    ],

    'passwords' => [
        'resets' => 'resets',
        'activations' => 'activations',
    ],
]

config/auth.php

return [
     'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],
    ],

    'passwords' => [
        'resets' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],

        'activations' => [
            'provider' => 'users',
            'table' => 'password_activations',
            'expire' => 4320,
            'throttle' => 60,
        ],
    ],

### How to reproduce

1. Install Statamic
2. Set up eloquent users
3. Make a user
4. Try reset the password at `/cp/auth/password/reset`

### Logs

```shell
https://flareapp.io/share/17WlYbJ5#F82

Environment

Environment
Application Name: JOY Theater
Laravel Version: 9.22.1
PHP Version: 8.1.8
Composer Version: 2.1.1
Environment: local
Debug Mode: ENABLED
URL: thejoytheater.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: pusher
Cache: redis
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 6
Antlers: runtime
Version: 3.3.24 PRO

Statamic Addons
aryehraber/statamic-logbook: 2.1.0
aryehraber/statamic-splash: 1.1.0
doublethreedigital/runway: 2.4.3
jacksleight/bard-paragraph-style: 1.2.3
mattrothenberg/statamic-mapbox-address: 0.7.2
statamic/collaboration: 0.4.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

runtime (new)

Additional details

No response

duncanmcclean commented 2 years ago

Thanks for all the details!

However, looking at the exception, it seems like this is a duplicate of #2133.

byron-roots commented 2 years ago

Ahh sorry not sure how I missed that one! Thanks