Sunday 16 May 2021

Laravel 5.7 confirmed validator , add parameter to request in backend, create resetpwd with reset pwd link

 Front end needs ;


You should design your form as below;

<input type="password" name="password">
<input type="password" name="password_confirmation">

for laravel confirmed validator
$request->validate([
        "password" => 'required|confirmed' 
    ]);

https://stackoverflow.com/questions/30170394/how-to-make-laravel-confirmed-validator-to-add-errors-to-the-confirmation-fiel


Add Parameter in backend to request
$request->request->add(['variable' => 'value']); //add request
https://stackoverflow.com/questions/37107903/laravel-is-there-a-way-to-add-values-to-a-request-array

Password resets:
https://laravel.com/docs/5.7/passwords
use Illuminate\Foundation\Auth\ResetsPasswords;
needs token and email from request,
the idea is, reset password link is send to user with mylink.com?email=xxx&token=xxx;
token is generated in backend with user email and expiry date,
so when 
mylink.com?email=xxx&token=xxx, token will always be checked with the email address supplied, 
if they don't match, error will be shown.

No comments:

Post a Comment