0
0
Laravelframework~10 mins

Password reset in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
AsendPasswordReset
BsendResetLinkEmail
CsendResetLink
DsendEmailResetLink
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent method like sendResetLinkEmail.
Confusing the method name with sendPasswordReset.
2fill in blank
medium

Complete 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'
Ahash($password)
Bbcrypt($password)
Cmd5($password)
D$password
Attempts:
3 left
💡 Hint
Common Mistakes
Saving the password as plain text.
Using insecure hash functions like md5.
3fill in blank
hard

Fix 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'
A'confirmed'
B'confirm'
C'password_confirmation'
D'match_confirmation'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'confirm' instead of 'confirmed'.
Using the field name 'password_confirmation' as a rule.
4fill in blank
hard

Fill 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'
Atoken
Bemail
Ctoken_value
Demail_address
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong input names like 'token_value'.
Using incorrect request keys like 'email_address'.
5fill in blank
hard

Fill 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'
Aget
Btoken
CshowResetForm
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST for showing the form.
Using wrong method names in controller.