Skip to main content
Category:

Validate the password reset token before showing the reset form

 

Example to Validate the password reset token before showing the reset form:

 


public function checkToken($token,$email)
{
    $password_resets = DB::table('password_resets')->where('email', $email)->first();

    if ($password_resets &&  Hash::check($token, $password_resets->token)) {
        $createdAt = Carbon::parse($password_resets->created_at);
        if (!Carbon::now()->greaterThan($createdAt->addMinutes(config('auth.passwords.users.expire')))) {
            return \response()->json()->setStatusCode(200);
        }
    }

    return \response()->json()->setStatusCode(419);
}

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook