docs icon indicating copy to clipboard operation
docs copied to clipboard

Additional config details required for independent auth guard docs

Open stuartcusackie opened this issue 3 years ago • 1 comments

When using eloquent for your app's users and statamic's file driver for your control panel users you need a separate password reset config. Otherwise control panel password resets fail: Call to undefined method App\Models\User::email() See this issue.

My example config is below. Can we get something similar added to the docs? Docs url: https://statamic.dev/tips/using-an-independent-authentication-guard

config/auth.php

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

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

  'resets_statamic' => [
    'provider' => 'statamic',
    'table' => 'password_resets',
    'expire' => 60,
    'throttle' => 60,
  ],

  'activations_statamic' => [
    'provider' => 'statamic',
    'table' => 'password_activations',
    'expire' => 4320,
    'throttle' => 60,
  ],
],

config/statamic/users.php

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

Thanks

stuartcusackie avatar Sep 10 '22 21:09 stuartcusackie

Please also consider updating the linked docs page to run through a full example of using the statamic auth guard for the control panel and a custom web guard for the front-end. e.g.:

 'guards' => [
   'cp' => 'statamic',
   'web' => 'web',
 ],

stuartcusackie avatar Sep 14 '22 15:09 stuartcusackie