n Laravel - Validate the password reset token before showing the reset form | CodimTh

Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
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