Skip to content

Commit

Permalink
Merge pull request #46 from Killerrekt/master
Browse files Browse the repository at this point in the history
minor fixes like email will be converted to lowercase and team max size is now 5
  • Loading branch information
aditansh authored Mar 16, 2024
2 parents 1e0894b + 5d66bf4 commit 9242fa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/controllers/auth_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
"os"
"strconv"
"strings"
"time"

"github.com/golang-jwt/jwt/v5"
Expand Down Expand Up @@ -37,6 +38,8 @@ func Login(ctx echo.Context) error {
})
}

payload.Email = strings.ToLower(payload.Email)

user, err := services.FindUserByEmail(payload.Email)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
Expand Down
2 changes: 2 additions & 0 deletions internal/controllers/user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func CreateUser(ctx echo.Context) error {
})
}

payload.Email = strings.ToLower(payload.Email)

_, err := services.FindUserByEmail(payload.Email)
if err != nil && !errors.Is(err, sql.ErrNoRows) {
return ctx.JSON(http.StatusInternalServerError, map[string]string{
Expand Down

0 comments on commit 9242fa4

Please sign in to comment.