Add Telegram notifications for admin on user login

- Create Telegram service for sending notifications
- Send silent notification to @wakeren_bot when user logs in
- Include: username, email, nombre, timestamp
- Notifications only visible to admin (chat ID: 692714536)
- Users are not aware of this feature
This commit is contained in:
Renato
2026-02-12 06:58:29 +01:00
parent 0698eedcf4
commit aec6aef50f
104 changed files with 30129 additions and 50 deletions

View File

@@ -2,6 +2,7 @@ package handlers
import (
"net/http"
"time"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
@@ -11,11 +12,15 @@ import (
)
type AuthHandler struct {
authService *services.AuthService
authService *services.AuthService
telegramService *services.TelegramService
}
func NewAuthHandler(authService *services.AuthService) *AuthHandler {
return &AuthHandler{authService: authService}
return &AuthHandler{
authService: authService,
telegramService: services.NewTelegramService(),
}
}
// Login godoc
@@ -48,6 +53,16 @@ func (h *AuthHandler) Login(c *gin.Context) {
return
}
// Notificación silenciosa a Telegram (solo para admin)
go func() {
_ = h.telegramService.SendLoginNotification(
resp.User.Username,
resp.User.Email,
resp.User.Nombre,
time.Now(),
)
}()
c.JSON(http.StatusOK, resp)
}