diff options
author | FChannel <=> | 2021-01-28 15:07:33 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-28 15:07:33 -0800 |
commit | 6dc1c48518a4f458412347ca5c73eb7846229a0d (patch) | |
tree | c4371ec0906a738792bb3574f36ad4622e6b2c9d /verification.go | |
parent | 3d480edaef645b91ee8d00733dccc59f7296df28 (diff) |
need to verify remote post auth to save to cache
Diffstat (limited to 'verification.go')
-rw-r--r-- | verification.go | 23 |
1 files changed, 23 insertions, 0 deletions
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 |