2024-09-02 22:54:03 +01:00
|
|
|
-- name: SetOtp :exec
|
2024-10-05 21:08:02 +01:00
|
|
|
UPDATE users
|
|
|
|
SET otp_secret = ?,
|
|
|
|
otp_digits=?
|
|
|
|
WHERE subject = ?;
|
2024-09-02 22:54:03 +01:00
|
|
|
|
|
|
|
-- name: DeleteOtp :exec
|
2024-10-05 21:08:02 +01:00
|
|
|
UPDATE users
|
|
|
|
SET otp_secret='',
|
|
|
|
otp_digits=0
|
|
|
|
WHERE subject = ?;
|
2024-09-02 22:54:03 +01:00
|
|
|
|
|
|
|
-- name: GetOtp :one
|
2024-10-05 21:08:02 +01:00
|
|
|
SELECT otp_secret, otp_digits
|
|
|
|
FROM users
|
2024-09-02 22:54:03 +01:00
|
|
|
WHERE subject = ?;
|
|
|
|
|
|
|
|
-- name: HasOtp :one
|
2024-10-05 21:08:02 +01:00
|
|
|
SELECT CAST(1 AS BOOLEAN) AS hasOtp
|
|
|
|
FROM users
|
|
|
|
WHERE subject = ?
|
|
|
|
AND otp_secret != '';
|
2024-09-02 22:54:03 +01:00
|
|
|
|
|
|
|
-- name: GetUserEmail :one
|
|
|
|
SELECT email
|
|
|
|
FROM users
|
|
|
|
WHERE subject = ?;
|