Skip to content

Commit

Permalink
Handle empty profile email when signing in with Apple
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito committed Nov 9, 2023
1 parent c9eae8b commit 1791a6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/core_authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func AuthenticateApple(ctx context.Context, logger *zap.Logger, db *sql.DB, clie

// Create a new account.
userID := uuid.Must(uuid.NewV4()).String()
query = "INSERT INTO users (id, username, email, apple_id, create_time, update_time) VALUES ($1, $2, $3, $4, now(), now())"
query = "INSERT INTO users (id, username, email, apple_id, create_time, update_time) VALUES ($1, $2, NULLIF($3, ''), $4, now(), now())"
result, err := db.ExecContext(ctx, query, userID, username, profile.Email, profile.ID)
if err != nil {
var pgErr *pgconn.PgError
Expand Down

0 comments on commit 1791a6a

Please sign in to comment.