diff options
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 |