fix args in db queries

This commit is contained in:
Ilya Sosnovsky 2022-12-02 19:34:21 +03:00
parent bc7f26f14d
commit 5eefd1b4d3
2 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import (
)
const (
version = "1.0.8"
version = "1.0.9"
)
var (

View File

@ -213,7 +213,7 @@ func (oUser *OpenvpnUser) RegisterOtpApplication(username, totp string) (string,
return "", authErr
}
if authOk {
_, err := oUser.Database.Exec("UPDATE users SET app_configured = 1 WHERE username = $2")
_, err := oUser.Database.Exec("UPDATE users SET app_configured = 1 WHERE username = $1", username)
if err != nil {
return "", err
}
@ -232,7 +232,7 @@ func (oUser *OpenvpnUser) ResetOtpApplication(username string) (string, error) {
return "", appErr
}
if appConfigured {
_, err := oUser.Database.Exec("UPDATE users SET app_configured = 0 WHERE username = $2")
_, err := oUser.Database.Exec("UPDATE users SET app_configured = 0 WHERE username = $1", username)
if err != nil {
return "", err
}
@ -263,6 +263,7 @@ func (oUser *OpenvpnUser) IsSecondFactorEnabled(username string) (bool, error) {
if u.name == username {
return u.appConfigured, nil
}
return false, checkAppError
}
return false, userIsNotActiveError