Skip to content

Commit

Permalink
Handle empty profile email when signing in with Apple (#1133)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesposito committed Nov 10, 2023
1 parent 424ebc5 commit bfa6962
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
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 bfa6962

Please sign in to comment.