mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 21:14:36 +00:00
Remove case sensitivity from emails
This commit is contained in:
@@ -64,7 +64,7 @@ func (i *Invites) Create(ctx context.Context, req *pb.CreateRequest, rsp *pb.Cre
|
|||||||
ID: uuid.New().String(),
|
ID: uuid.New().String(),
|
||||||
Code: generateCode(),
|
Code: generateCode(),
|
||||||
GroupID: req.GroupId,
|
GroupID: req.GroupId,
|
||||||
Email: req.Email,
|
Email: strings.ToLower(req.Email),
|
||||||
}
|
}
|
||||||
if err := i.DB.Create(invite).Error; err != nil && strings.Contains(err.Error(), "group_email") {
|
if err := i.DB.Create(invite).Error; err != nil && strings.Contains(err.Error(), "group_email") {
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@@ -116,7 +116,7 @@ func (i *Invites) List(ctx context.Context, req *pb.ListRequest, rsp *pb.ListRes
|
|||||||
query.GroupID = req.GroupId.Value
|
query.GroupID = req.GroupId.Value
|
||||||
}
|
}
|
||||||
if req.Email != nil {
|
if req.Email != nil {
|
||||||
query.Email = req.Email.Value
|
query.Email = strings.ToLower(req.Email.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// query the database
|
// query the database
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ func (u *Users) Create(ctx context.Context, req *pb.CreateRequest, rsp *pb.Creat
|
|||||||
ID: uuid.New().String(),
|
ID: uuid.New().String(),
|
||||||
FirstName: req.FirstName,
|
FirstName: req.FirstName,
|
||||||
LastName: req.LastName,
|
LastName: req.LastName,
|
||||||
Email: req.Email,
|
Email: strings.ToLower(req.Email),
|
||||||
Password: phash,
|
Password: phash,
|
||||||
}
|
}
|
||||||
err = u.DB.Create(user).Error
|
err = u.DB.Create(user).Error
|
||||||
@@ -184,7 +184,7 @@ func (u *Users) Update(ctx context.Context, req *pb.UpdateRequest, rsp *pb.Updat
|
|||||||
user.LastName = req.LastName.Value
|
user.LastName = req.LastName.Value
|
||||||
}
|
}
|
||||||
if req.Email != nil {
|
if req.Email != nil {
|
||||||
user.Email = req.Email.Value
|
user.Email = strings.ToLower(req.Email.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the user to the database
|
// write the user to the database
|
||||||
|
|||||||
Reference in New Issue
Block a user