Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Label Space login notifications correctly

Anand Baburajanef1985a233e7
diff --git a/server/pkg/controller/user/userauth.go b/server/pkg/controller/user/userauth.go
index f47dd7f9b2..faf619a010 100644
--- a/server/pkg/controller/user/userauth.go
+++ b/server/pkg/controller/user/userauth.go
@@ -1,7 +1,6 @@
package user
import (
- "context"
"database/sql"
"encoding/base64"
"errors"
@@ -506,7 +505,7 @@ func (c *UserController) ClearStorageWarningDeletionLoginBlock(userID int64) err
return c.NotificationHistoryRepo.ClearStorageWarningDeletionScheduled(userID)
}
-func (c *UserController) AddTokenAndNotify(ctx context.Context, userID int64, app ente.App, token string, ip string, userAgent string) error {
+func (c *UserController) AddTokenAndNotify(ctx *gin.Context, userID int64, app ente.App, token string, ip string, userAgent string) error {
if err := c.ensureStorageWarningDeletionLoginAllowed(userID, app); err != nil {
return err
}
@@ -522,6 +521,7 @@ func (c *UserController) AddTokenAndNotify(ctx context.Context, userID int64, ap
return nil
}
+ clientPackage := ctx.GetHeader("X-Client-Package")
go func() {
user, userErr := c.UserRepo.GetUserByIDInternal(userID)
if userErr != nil {
@@ -541,6 +541,9 @@ func (c *UserController) AddTokenAndNotify(ctx context.Context, userID int64, ap
if !ok {
appName = "Ente"
}
+ if clientPackage == "io.ente.space.web" {
+ appName = "Ente Space"
+ }
device := "Unknown Device"
if strings.TrimSpace(userAgent) != "" {
device = network.GetPrettyUA(userAgent)