Skip to content

Commit f4c6305

Browse files
committed
fix enable two fa
1 parent 3ff52dd commit f4c6305

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

internal/database/app/user.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,8 @@ func UploadStudentID(userID uuid.UUID, studentID string) error {
264264
_, err := database.DB.Exec(context.Background(), "UPDATE users SET student_id_verification = $1 WHERE id = $2", studentID, userID)
265265
return err
266266
}
267+
268+
func SaveTwoFAInfo(userID uuid.UUID, secret string, image string) error {
269+
_, err := database.DB.Exec(context.Background(), "UPDATE users SET twofa_image = $1, twofa_secret = $2 WHERE id = $3", image, secret, userID)
270+
return err
271+
}

internal/services/user_services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (us *UserService) EnableTwoFA(userID uuid.UUID) (string, string, error) {
153153
user.TwoFASecret = &secretStr
154154
user.TwoFAImage = &qr
155155

156-
err = app.UpdateUser(userID, user)
156+
err = app.SaveTwoFAInfo(userID, secretStr, qr)
157157
if err != nil {
158158
return "", "", err
159159
}

0 commit comments

Comments
 (0)