Skip to content

Commit a9007c7

Browse files
committed
fix: update user for twofa
1 parent 31c8bd1 commit a9007c7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

internal/database/app/user.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,25 @@ func UpdateUser(UserID uuid.UUID, updatedUser *models.User) error {
233233
argID++
234234
}
235235

236+
if updatedUser.TwoFASecret != nil && *updatedUser.TwoFASecret != "" {
237+
query += "twofa_secret = $" + strconv.Itoa(argID) + ", "
238+
args = append(args, updatedUser.TwoFASecret)
239+
argID++
240+
}
241+
242+
if updatedUser.TwoFAImage != nil && *updatedUser.TwoFAImage != "" {
243+
query += "twofa_image = $" + strconv.Itoa(argID) + ", "
244+
args = append(args, updatedUser.TwoFAImage)
245+
argID++
246+
}
247+
248+
if updatedUser.TwoFAEnabled != false {
249+
query += "twofa_enabled = $" + strconv.Itoa(argID) + ", "
250+
args = append(args, updatedUser.TwoFAEnabled)
251+
argID++
252+
253+
}
254+
236255
// Remove the last comma and space
237256
query = strings.TrimSuffix(query, ", ")
238257

0 commit comments

Comments
 (0)