Reset password via a route

 To do that, open the routes/web.php file with your favirute text editor and add the following right after the opening PHP tag:

<?php
Route::get('temporary-password-reset', function() {
    $user = App\Moleds\User::where('email', 'your_email@example.com')->first();
    $user->password = Hash::make('your_super_secure_password');
    $user->save();
 
    return 'Success!';
});

Note: if you are using Laravel 7 or bellow, you might have to change App\Models\User to App\User, depending on where you store your models at.

Save that, and then visit the link /temporary-password-reset URL via your browser. This will trigger the password change.

Note: Make sure to delete the route, once you've changed your password!

Comments

Popular posts from this blog

Js adding Modify and Deleting Properties

JS Rest Parameter

How to Add Social Media Share Buttons in Laravel?