change fetch users

This commit is contained in:
Pavel 2024-01-18 18:25:33 +03:00
parent 67e410f8a7
commit 5115a132ba

@ -3,7 +3,6 @@ package controller
import (
"codeword/internal/models"
"codeword/internal/services"
"encoding/base64"
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
"time"
@ -44,15 +43,15 @@ func (r *RecoveryController) HandleRecoveryRequest(c *fiber.Ctx) error {
r.logger.Error("Failed to find user by email", zap.Error(err))
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "User not found"})
}
key := []byte("GSiyv5zBITGshqnvYLHKtXE3e4yZjKGvruOVFWuUuj9Nvaps28-Zt6RDq9n47eaNUlay1-nUVld61I3xoAAgCA==65a79d5d67734ab00b3c9463")
key := "GSiyv5zBITGshqnvYLHKtXE3e4yZjKGvruOVFWuUuj9Nvaps28-Zt6RDq9n47eaNUlay1-nUVld61I3xoAAgCA==65a79d5d67734ab00b3c9463"
//key, err := r.service.GenerateKey()
//if err != nil {
// r.logger.Error("Failed to generate key", zap.Error(err))
// return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "Internal Server Error"})
//}
signUrl := redirectionURL + base64.URLEncoding.EncodeToString(key)
sign := base64.URLEncoding.EncodeToString(key)
signUrl := redirectionURL + key
sign := key
id, err := r.service.StoreRecoveryRecord(c.Context(), models.StoreRecDeps{UserID: user.ID.Hex(), Email: user.Email, Key: sign, Url: signUrl})
if err != nil {