Unverified Commit bfa69624 authored by Simon Esposito's avatar Simon Esposito Committed by GitHub
Browse files

Handle empty profile email when signing in with Apple (#1133)

parent 424ebc56
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,9 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- RPC now allows omitting the `unwrap` parameter for requests with empty payloads.
- Upgrade GRPC dependency.

### Fixed
- Correctly handle empty email field when authenticating via Apple Sign In.

## [3.18.0] - 2023-10-24
### Added
- Allow HTTP key to be read from an HTTP request's Basic auth header if present.
+1 −1
Original line number Diff line number Diff line
@@ -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