Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to send a password reset link email using Laravel's built-in method.
Laravel
use Illuminate\Support\Facades\Password; Password::[1](['email' => $request->email]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent method like sendResetLinkEmail.
Confusing the method name with sendPasswordReset.
✗ Incorrect
The correct method to send a password reset link in Laravel is sendResetLink.
2fill in blank
mediumComplete the code to validate the password reset token and update the user's password.
Laravel
use Illuminate\Support\Facades\Password;
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user, $password) {
$user->password = [1];
$user->save();
}
); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Saving the password as plain text.
Using insecure hash functions like md5.
✗ Incorrect
Laravel requires hashing the password using bcrypt before saving it.
3fill in blank
hardFix the error in the password reset validation rule for the new password confirmation.
Laravel
'password' => ['required', 'string', 'min:8', [1]],
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'confirm' instead of 'confirmed'.
Using the field name 'password_confirmation' as a rule.
✗ Incorrect
The correct validation rule to check password confirmation is 'confirmed'.
4fill in blank
hardFill both blanks to create a password reset form hidden input for the token field.
Laravel
<input type="hidden" name="[1]" value="{{ $request->[2] }}">
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong input names like 'token_value'.
Using incorrect request keys like 'email_address'.
✗ Incorrect
The hidden input name should be 'token' and the value should come from $request->token.
5fill in blank
hardFill all three blanks to define the route for password reset form display in Laravel.
Laravel
Route::[1]('/reset-password/[2]', [PasswordResetController::class, '[3]'])->name('password.reset');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST for showing the form.
Using wrong method names in controller.
✗ Incorrect
The GET route shows the reset form with token, and the controller method to show the form is showResetForm.