From 6dc1c48518a4f458412347ca5c73eb7846229a0d Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Thu, 28 Jan 2021 15:07:33 -0800 Subject: need to verify remote post auth to save to cache --- verification.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'verification.go') diff --git a/verification.go b/verification.go index b1ebe13..e0d94b8 100644 --- a/verification.go +++ b/verification.go @@ -170,6 +170,29 @@ func GetVerificationByCode(db *sql.DB, code string) Verify { return verify } +func GetVerificationCode(db *sql.DB, verify Verify) Verify { + var nVerify Verify + + query := `select type, identifier, code, board from boardaccess where identifier=$1 and board=$2` + + rows, err := db.Query(query, verify.Identifier, verify.Board) + + defer rows.Close() + + if err != nil { + CheckError(err, "error getting verify by code query") + return verify + } + + for rows.Next() { + err := rows.Scan(&nVerify.Type, &nVerify.Identifier, &nVerify.Code, &nVerify.Board) + + CheckError(err, "error getting verify by code scan") + } + + return verify +} + func VerifyCooldownCurrent(db *sql.DB, auth string) VerifyCooldown { var current VerifyCooldown -- cgit v1.2.3