Fix: Update users_by_email with all fields
The security_data field, which includes the WasEmailVerified flag, must be preserved during email updates. The update query now includes all fields in the users_by_email table. https://codeberg.org/mapleopentech/monorepo/issues/1#issuecomment-8725011
This commit is contained in:
parent
598a7d3fad
commit
5156835e80
1 changed files with 9 additions and 5 deletions
|
|
@ -62,13 +62,17 @@ func (impl userStorerImpl) UpdateByID(ctx context.Context, user *dom_user.User)
|
|||
// Delete old email entry
|
||||
batch.Query(`DELETE FROM users_by_email WHERE email = ?`, existingUser.Email)
|
||||
|
||||
// Insert new email entry
|
||||
// Insert new email entry with ALL fields including security_data
|
||||
// IMPORTANT: security_data contains WasEmailVerified flag which must be preserved
|
||||
batch.Query(`
|
||||
INSERT INTO users_by_email (
|
||||
email, id, first_name, last_name, status, created_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?)`,
|
||||
user.Email, user.ID, user.FirstName, user.LastName,
|
||||
user.Status, user.CreatedAt,
|
||||
email, id, first_name, last_name, name, lexical_name,
|
||||
role, status, timezone, created_at, modified_at,
|
||||
profile_data, security_data, metadata
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
||||
user.Email, user.ID, user.FirstName, user.LastName, user.Name, user.LexicalName,
|
||||
user.Role, user.Status, user.Timezone, user.CreatedAt, user.ModifiedAt,
|
||||
profileDataJSON, securityDataJSON, metadataJSON,
|
||||
)
|
||||
} else {
|
||||
// Just update the existing email entry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue