Skip to content

Commit

Permalink
fix args in db queries
Browse files Browse the repository at this point in the history
  • Loading branch information
pashcovich committed Dec 2, 2022
1 parent bc7f26f commit 5eefd1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openvpn-user.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

const (
version = "1.0.8"
version = "1.0.9"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions src/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5eefd1b

Please sign in to comment.