You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -301,20 +301,31 @@ Switch between templates in `config/otpz.php`:
301
301
302
302
### Custom User Resolution
303
303
304
-
By default, OTPz creates new users when an email doesn't exist. Customize this behavior:
304
+
By default, OTPz creates new users when an email doesn't exist. You can customize this behavior by creating your own user resolver and registering it in the config. In this example we throw a validation error if a user with the given email address does not exist.
305
305
306
306
```php
307
-
// Create your own resolver
308
307
namespace App\Actions;
309
308
310
-
use BenBjurstrom\Otpz\Contracts\UserResolver;
309
+
use App\Models\User;
310
+
use BenBjurstrom\Otpz\Models\Concerns\Otpable;
311
+
use Illuminate\Validation\ValidationException;
311
312
312
-
class MyUserResolver implements UserResolver
313
+
/**
314
+
* @method static Otpable run(string $email)
315
+
*/
316
+
class MyUserResolver
313
317
{
314
-
public function resolve(string $email): ?\Illuminate\Contracts\Auth\Authenticatable
0 commit comments