Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/routes/rooms.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func JoinRoomHandler(c *gin.Context) {

emailStr, ok := email.(string)
if !ok {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid email format"})
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid email format, Use [email protected]"})
return
}

Expand Down Expand Up @@ -221,7 +221,7 @@ func GetRoomParticipantsHandler(c *gin.Context) {
// Get user ID from email
emailStr, ok := email.(string)
if !ok {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid email format"})
c.JSON(http.StatusInternalServerError, gin.H{"error": "Invalid email format, Use [email protected]"})
return
}

Expand Down
2 changes: 1 addition & 1 deletion backend/utils/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func getJWTSecret() string {

// ExtractNameFromEmail extracts the username before '@'
func ExtractNameFromEmail(email string) string {
re := regexp.MustCompile(`^([^@]+)`)
re := regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`)
match := re.FindStringSubmatch(email)
if len(match) < 2 {
return email
Expand Down