1
0
Fork 0
mirror of synced 2024-11-24 01:45:35 -05:00

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 ( const (
version = "1.0.8" version = "1.0.9"
) )
var ( var (

View file

@ -213,7 +213,7 @@ func (oUser *OpenvpnUser) RegisterOtpApplication(username, totp string) (string,
return "", authErr return "", authErr
} }
if authOk { 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 { if err != nil {
return "", err return "", err
} }
@ -232,7 +232,7 @@ func (oUser *OpenvpnUser) ResetOtpApplication(username string) (string, error) {
return "", appErr return "", appErr
} }
if appConfigured { 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 { if err != nil {
return "", err return "", err
} }
@ -263,6 +263,7 @@ func (oUser *OpenvpnUser) IsSecondFactorEnabled(username string) (bool, error) {
if u.name == username { if u.name == username {
return u.appConfigured, nil return u.appConfigured, nil
} }
return false, checkAppError return false, checkAppError
} }
return false, userIsNotActiveError return false, userIsNotActiveError