[GH-ISSUE #70] verifyKeyNewer Not working Correctly #501

Closed
opened 2026-03-14 11:59:01 +03:00 by kerem · 2 comments
Owner

Originally created by @lukepolo on GitHub (Jun 21, 2017).
Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/70

I have a new user which does not have an old timestamp, so when validation happens it returns true, should it not return the timestamp instead?

Here is what im doing :


        $valid = $this->google2FA->verifyKeyNewer(
            $request->user()->second_auth_secret,
            $request->get('token'),
            $request->user()->second_auth_updated_at ? $request->user()->second_auth_updated_at->timestamp : null
        );

// since valid is a true / false 
        if ($valid !== false) {

            $request->user()->update([
                'second_auth_active' => true,
                // this is a true or false currently 
                'second_auth_updated_at' =>$valid,
            ]);
        }
Originally created by @lukepolo on GitHub (Jun 21, 2017). Original GitHub issue: https://github.com/antonioribeiro/google2fa/issues/70 I have a new user which does not have an old timestamp, so when validation happens it returns true, should it not return the timestamp instead? Here is what im doing : ``` $valid = $this->google2FA->verifyKeyNewer( $request->user()->second_auth_secret, $request->get('token'), $request->user()->second_auth_updated_at ? $request->user()->second_auth_updated_at->timestamp : null ); ``` ``` // since valid is a true / false if ($valid !== false) { $request->user()->update([ 'second_auth_active' => true, // this is a true or false currently 'second_auth_updated_at' =>$valid, ]); } ```
kerem closed this issue 2026-03-14 11:59:07 +03:00
Author
Owner

@antonioribeiro commented on GitHub (Jun 21, 2017):

Should be fixed now. Thanks for reporting.

<!-- gh-comment-id:310235068 --> @antonioribeiro commented on GitHub (Jun 21, 2017): Should be fixed now. Thanks for reporting.
Author
Owner

@lukepolo commented on GitHub (Jun 23, 2017):

Perfect, working great now !

<!-- gh-comment-id:310735642 --> @lukepolo commented on GitHub (Jun 23, 2017): Perfect, working great now !
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/google2fa#501
No description provided.