logger.Warn("Skipping apple account email import as it is already set in another user.",zap.Error(err),zap.String("appleID",profile.ID),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
}else{
logger.Error("Failed to import apple account email.",zap.Error(err),zap.String("appleID",profile.ID),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
return"","",false,status.Error(codes.Internal,"Error importing apple account email.")
}
}
returnuserID,username,true,nil
}
@@ -459,6 +471,18 @@ func AuthenticateFacebook(ctx context.Context, logger *zap.Logger, db *sql.DB, c
return"","",false,false,status.Error(codes.Internal,"Error finding or creating user account.")
}
// Import email address
_,err=db.ExecContext(ctx,"UPDATE users SET email = $1 WHERE id = $2",facebookProfile.Email,userID)
logger.Warn("Skipping facebook account email import as it is already set in another user.",zap.Error(err),zap.String("facebookID",facebookProfile.ID),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
}else{
logger.Error("Failed to import facebook account email.",zap.Error(err),zap.String("facebookID",facebookProfile.ID),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
if_,err=db.ExecContext(ctx,"UPDATE users SET "+strings.Join(statements,", ")+", update_time = now() WHERE id = $1",params...);err!=nil{
// Failure to update does not interrupt the execution. Just log the error and continue.
logger.Error("Error in updating google profile details",zap.Error(err),zap.String("googleId",googleProfile.Sub),zap.String("display_name",googleProfile.Name),zap.String("display_name",googleProfile.Picture))
logger.Error("Error in updating google profile details",zap.Error(err),zap.String("googleID",googleProfile.Sub),zap.String("display_name",googleProfile.Name),zap.String("display_name",googleProfile.Picture))
logger.Warn("Skipping google account email import as it is already set in another user.",zap.Error(err),zap.String("googleID",googleProfile.Sub),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
}else{
logger.Error("Failed to import google account email.",zap.Error(err),zap.String("googleID",googleProfile.Sub),zap.String("username",username),zap.Bool("create",create),zap.String("created_user_id",userID))
return"","",false,status.Error(codes.Internal,"Error importing google account email.")